Introduction and table of contents - The init file - The Main object - Importing new textures - Importing 3D meshes - New data types - List of instantiable objects - List of static objects
To setup the game, you must create a lua table named "Main" with the following methods:
Method | Description |
init() | Called when the application starts. Use it for example to load misc sprites and models. |
manage() | Called regularly. Use it for example to manage game elements. |
draw2D() | Called regularly. Use it for example to draw specific 2d sprites. |
draw3D() | Called regularly. Use it for example to draw specific 3d models. |
onKeyPressed(int key) | Called whenever the user pressed a keyboard key. key parameter may be:
|
onMousePressed(string mouse_button, Int2 pos) | Called whenever the user started clicking with the mouse.
|
onMouseReleased(string mouse_button, Int2 pos) | Called whenever the user finished clicking with the mouse.
|
onMouseMoved(bool is_mouse_pressed, Int2 pos) | Called whenever the mouse is moved on the screen. (x,y) are the pixel coordinates of the mouse and is_mouse_pressed is true if the mouse was pressed while moving. |
onMouseWheelChanged(int wheel_delta, Int2 pos) | Called whenever the user scrolled with the mouse wheel. wheel_delta is the wheel delta, most of the time 120, or a multiple of 120. (x,y) are the pixel coordinates of the mouse at the moment the wheel was moved. |
onSemanticZoom(number value) | Called on a tablet when the user used two fingers to zoom/unzoom. value is the zoom intensity. (Only available if this is a Windows Store app) |
uninit() | Called when application stops. Use it for example to unload misc sprites and models. |