The Application class forms the foundation for most Lime projects. It is common to extend this class in a main class. It is then possible to override "on" functions in the class in order to handle standard events that are relevant.
Static variables
Constructor
Variables
onCreateWindow:_Event_lime_ui_Window_Void<Window ‑> Void> = new Event<Window>()
Dispatched when a new window has been created by this application
onUpdate:_Event_Int_Void<Int ‑> Void> = new Event<Int>()
Update events are dispatched each frame (usually just before rendering)
Methods
createWindow(attributes:WindowAttributes):Window
Creates a new Window and adds it to the Application
Parameters:
attributes | A set of parameters to initialize the window |
---|
exec():Int
Execute the Application. On native platforms, this method blocks until the application is finished running. On other platforms, it will return immediately
Returns:
An exit code, 0 if there was no error
onGamepadAxisMove(gamepad:Gamepad, axis:GamepadAxis, value:Float):Void
Called when a gamepad axis move event is fired
Parameters:
gamepad | The current gamepad |
---|---|
axis | The axis that was moved |
value | The axis value (between 0 and 1) |
onGamepadButtonDown(gamepad:Gamepad, button:GamepadButton):Void
Called when a gamepad button down event is fired
Parameters:
gamepad | The current gamepad |
---|---|
button | The button that was pressed |
onGamepadButtonUp(gamepad:Gamepad, button:GamepadButton):Void
Called when a gamepad button up event is fired
Parameters:
gamepad | The current gamepad |
---|---|
button | The button that was released |
onGamepadConnect(gamepad:Gamepad):Void
Called when a gamepad is connected
Parameters:
gamepad | The gamepad that was connected |
---|
onGamepadDisconnect(gamepad:Gamepad):Void
Called when a gamepad is disconnected
Parameters:
gamepad | The gamepad that was disconnected |
---|
onJoystickAxisMove(joystick:Joystick, axis:Int, value:Float):Void
Called when a joystick axis move event is fired
Parameters:
joystick | The current joystick |
---|---|
axis | The axis that was moved |
value | The axis value (between 0 and 1) |
onJoystickButtonDown(joystick:Joystick, button:Int):Void
Called when a joystick button down event is fired
Parameters:
joystick | The current joystick |
---|---|
button | The button that was pressed |
onJoystickButtonUp(joystick:Joystick, button:Int):Void
Called when a joystick button up event is fired
Parameters:
joystick | The current joystick |
---|---|
button | The button that was released |
onJoystickConnect(joystick:Joystick):Void
Called when a joystick is connected
Parameters:
joystick | The joystick that was connected |
---|
onJoystickDisconnect(joystick:Joystick):Void
Called when a joystick is disconnected
Parameters:
joystick | The joystick that was disconnected |
---|
onJoystickHatMove(joystick:Joystick, hat:Int, position:JoystickHatPosition):Void
Called when a joystick hat move event is fired
Parameters:
joystick | The current joystick |
---|---|
hat | The hat that was moved |
position | The current hat position |
onKeyDown(keyCode:KeyCode, modifier:KeyModifier):Void
Called when a key down event is fired on the primary window
Parameters:
keyCode | The code of the key that was pressed |
---|---|
modifier | The modifier of the key that was pressed |
onKeyUp(keyCode:KeyCode, modifier:KeyModifier):Void
Called when a key up event is fired on the primary window
Parameters:
keyCode | The code of the key that was released |
---|---|
modifier | The modifier of the key that was released |
onMouseDown(x:Float, y:Float, button:MouseButton):Void
Called when a mouse down event is fired on the primary window
Parameters:
x | The current x coordinate of the mouse |
---|---|
y | The current y coordinate of the mouse |
button | The ID of the mouse button that was pressed |
onMouseMove(x:Float, y:Float):Void
Called when a mouse move event is fired on the primary window
Parameters:
x | The current x coordinate of the mouse |
---|---|
y | The current y coordinate of the mouse |
onMouseMoveRelative(x:Float, y:Float):Void
Called when a mouse move relative event is fired on the primary window
Parameters:
x | The x movement of the mouse |
---|---|
y | The y movement of the mouse |
onMouseUp(x:Float, y:Float, button:MouseButton):Void
Called when a mouse up event is fired on the primary window
Parameters:
x | The current x coordinate of the mouse |
---|---|
y | The current y coordinate of the mouse |
button | The ID of the button that was released |
onMouseWheel(deltaX:Float, deltaY:Float, deltaMode:MouseWheelMode):Void
Called when a mouse wheel event is fired on the primary window
Parameters:
deltaX | The amount of horizontal scrolling (if applicable) |
---|---|
deltaY | The amount of vertical scrolling (if applicable) |
deltaMode | The units of measurement used |
onPreloadProgress(loaded:Int, total:Int):Void
Called when a preload progress event is fired
Parameters:
loaded | The number of items that are loaded |
---|---|
total | The total number of items will be loaded |
onRenderContextRestored(context:RenderContext):Void
Called when a render context is restored on the primary window
Parameters:
context | The render context relevant to the event |
---|
onTextEdit(text:String, start:Int, length:Int):Void
Called when a text edit event is fired on the primary window
Parameters:
text | The current replacement text |
---|---|
start | The starting index for the edit |
length | The length of the edit |
onTextInput(text:String):Void
Called when a text input event is fired on the primary window
Parameters:
text | The current input text |
---|
onTouchCancel(touch:Touch):Void
Called when a touch cancel event is fired
Parameters:
touch | The current touch object |
---|
onTouchEnd(touch:Touch):Void
Called when a touch end event is fired
Parameters:
touch | The current touch object |
---|
onTouchMove(touch:Touch):Void
Called when a touch move event is fired
Parameters:
touch | The current touch object |
---|
onTouchStart(touch:Touch):Void
Called when a touch start event is fired
Parameters:
touch | The current touch object |
---|
onWindowDropFile(file:String):Void
Called when a window drop file event is fired on the primary window
onWindowMove(x:Float, y:Float):Void
Called when a window move event is fired on the primary window
Parameters:
x | The x position of the window in desktop coordinates |
---|---|
y | The y position of the window in desktop coordinates |
onWindowResize(width:Int, height:Int):Void
Called when a window resize event is fired on the primary window
Parameters:
width | The width of the window |
---|---|
height | The height of the window |
removeModule(module:IModule):Void
Removes a module from the Application
Parameters:
module | A module to remove |
---|
render(context:RenderContext):Void
Called when a render event is fired on the primary window
Parameters:
context | The render context ready to be rendered |
---|
update(deltaTime:Int):Void
Called when an update event is fired on the primary window
Parameters:
deltaTime | The amount of time in milliseconds that has elapsed since the last update |
---|