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.

Constructor

new ()

Creates a new Application instance

Variables

read onlymodules:Array<IModule>

A list of currently attached Module instances

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)

read onlypreloader:Preloader

The Preloader for the current Application

read onlywindow:Window

The Window associated with this Application, or the first Window if there are multiple Windows active

read onlywindows:Array<Window>

A list of active Window instances associated with this Application

Methods

addModule (module:IModule):Void

Adds a new module to the Application

Parameters:

module

A module to add

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

onJoystickTrackballMove (joystick:Joystick, trackball:Int, x:Float, y:Float):Void

Called when a joystick axis move event is fired

Parameters:

joystick

The current joystick

trackball

The trackball that was moved

x

The x movement of the trackball (between 0 and 1)

y

The y movement of the trackball (between 0 and 1)

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

onModuleExit (code:Int):Void

Called when the module is exiting

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

onPreloadComplete ():Void

Called when a preload complete event is fired

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

onRenderContextLost ():Void

Called when a render context is lost on the primary window

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

onWindowActivate ():Void

Called when a window activate event is fired on the primary window

onWindowClose ():Void

Called when a window close event is fired on the primary window

onWindowCreate ():Void

Called when the primary window is created

onWindowDeactivate ():Void

Called when a window deactivate event is fired on the primary window

onWindowDropFile (file:String):Void

Called when a window drop file event is fired on the primary window

onWindowEnter ():Void

Called when a window enter event is fired on the primary window

onWindowExpose ():Void

Called when a window expose event is fired on the primary window

onWindowFocusIn ():Void

Called when a window focus in event is fired on the primary window

onWindowFocusOut ():Void

Called when a window focus out event is fired on the primary window

onWindowFullscreen ():Void

Called when the primary window enters fullscreen

onWindowLeave ():Void

Called when a window leave event is fired on the primary window

onWindowMinimize ():Void

Called when the primary window is minimized

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

onWindowRestore ():Void

Called when the primary window is restored from being minimized or fullscreen

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

Static variables

staticread onlycurrent:Application

The current Application instance that is executing

Inherited Variables

Defined by Module

onExit:_Event_Int_Void<Int ‑> Void> = new Event<Int>()

Exit events are dispatched when the application is exiting

Inherited Methods