class lime.app.Application extends Module

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.

Class Fields

static var onUpdate:Event<Int ->Void>

Update events are dispatched each frame (usually just before rendering)

Instance Fields

Show inherited public instance fieldsHide inherited public instance fields

Inherited from Module

function new(): Void

function addWindow(window:Window): Void

Adds a new Window to the Application. By default, this is called automatically by create()

window

A Window object to add

function create(config:Config): Void

Initializes the Application, using the settings defined in the config instance. By default, this is called automatically when building the project using Lime's command-line tools

config

A Config object

function 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

function init(context:RenderContext): Void

The init() method is called once before the first render() call. This can be used to do initial set-up for the current render context

context

The current render context

function onKeyDown(keyCode:Int, modifier:Int): Void

Called when a key down event is fired

keyCode

The code of the key that was pressed

modifier

The modifier of the key that was pressed

function onKeyUp(keyCode:Int, modifier:Int): Void

Called when a key up event is fired

keyCode

The code of the key that was released

modifier

The modifier of the key that was released

function onMouseDown(x:Float, y:Float, button:Int): Void

Called when a mouse down event is fired

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

function onMouseMove(x:Float, y:Float, button:Int): Void

Called when a mouse move event is fired

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

function onMouseUp(x:Float, y:Float, button:Int): Void

Called when a mouse up event is fired

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

function onMouseWheel(deltaX:Float, deltaY:Float): Void

Called when a mouse wheel event is fired

deltaX

The amount of horizontal scrolling (if applicable)

deltaY

The amount of vertical scrolling (if applicable)

function onRenderContextLost(): Void

Called when a render context is lost

function onRenderContextRestored(context:RenderContext): Void

Called when a render context is restored

context

The current render context

function onTouchEnd(x:Float, y:Float, id:Int): Void

Called when a touch end event is fired

x

The current x coordinate of the touch point

y

The current y coordinate of the touch point

id

The ID of the touch point

function onTouchMove(x:Float, y:Float, id:Int): Void

Called when a touch move event is fired

x

The current x coordinate of the touch point

y

The current y coordinate of the touch point

id

The ID of the touch point

function onTouchStart(x:Float, y:Float, id:Int): Void

Called when a touch start event is fired

x

The current x coordinate of the touch point

y

The current y coordinate of the touch point

id

The ID of the touch point

function onWindowActivate(): Void

Called when a window activate event is fired

function onWindowClose(): Void

Called when a window close event is fired

function onWindowDeactivate(): Void

Called when a window deactivate event is fired

function onWindowFocusIn(): Void

Called when a window focus in event is fired

function onWindowFocusOut(): Void

Called when a window focus out event is fired

function onWindowMove(x:Float, y:Float): Void

Called when a window move event is fired

x

The x position of the window

y

The y position of the window

function onWindowResize(width:Int, height:Int): Void

Called when a window resize event is fired

width

The width of the window

height

The height of the window

function render(context:RenderContext): Void

Called when a render event is fired

context

The current render context

function update(deltaTime:Int): Void

Called when an update event is fired

deltaTime

The amount of time in milliseconds that has elapsed since the last update