moonbase.event callbacks - Protovision/moonbase GitHub Wiki
moonbase.event.initialize( )
If this function is defined, the engine will call it after the game window has been created
moonbase.event.input( e )
If this function is defined, the engine will call it whenever there is user input. e will be supplied as a table that containing the following attributes depending on the type of user input:
- If keyboard user input, then e.type will be set to "keyboard", e.key will be a string representing the key that was pressed, and e.pressed will be true if the key was pressed down or false if the key was released.
- If mouse button user input, then e.type will be set to "mouse"; e.button will be 1 for left click, 2 for middle click, or 3 for right click; e.x will be the x coordinate of the mouse click; e.y will be the y coordinate of the mouse click; e.pressed will be true if the mouse button was pressed down or false if released.
- If text input user input, then e.type will be set to "text input", e.text will be the text input string which should usually be appended to the text box that is being typed into.
- If mouse wheel user input; then e.type will be set to "wheel"; e.direction will be 1 for scrolling up or 2 for scrolling down.
moonbase.event.update( ms )
If this function is defined, the engine will call it every game frame, supplying the number of milliseconds that have passed since the application started
moonbase.event.shutdown( )
If this function is defined, the engine will call it before shutting down