Class Application
Singleton object.
The main class for managing scenes and the viewport.
Functions
application:resize_viewport (w, h[, opt]) | Resize viewport. |
application:get_viewport () | Get viewport dimensions. |
application:switch_scene (name) | Change scene with a transition effect. |
application:add_scene (name) | Add scene to the scene list. |
application:get_scene (name) | Get scene from the scene list by the name. |
application:set_scene (name) | Set current scene by the name. |
application:get_current_scene () | Get current scene. |
application:update (dt) | Main update function. |
application:render (dt) | Main render function. |
application.resize (w, h) | Resize callback. |
application.mousemoved (x, y, dx, dy, istouch) | mousemoved callback. |
application.wheelmoved (x, y) | wheelmoved callback. |
application.mousepressed (x, y, button) | mousepressed callback. |
application.mousereleased (x, y, button) | mousereleased callback. |
application.keypressed (key, scancode, isrepeat) | keypressed callback. |
application.keyreleased (key, scancode, isrepeat) | keyreleased callback. |
Functions
- application:resize_viewport (w, h[, opt])
-
Resize viewport.
Parameters:
- w number Virtual viewport width
- h number Virtual viewport height
- opt table canvas format, filter and msaa. {format=, msaa=, filter=} (optional)
- application:get_viewport ()
-
Get viewport dimensions.
Returns:
- number x
- number y
- number w
- number h
- application:switch_scene (name)
-
Change scene with a transition effect.
Parameters:
- name string
- application:add_scene (name)
-
Add scene to the scene list.
Parameters:
- name string
- application:get_scene (name)
-
Get scene from the scene list by the name.
Parameters:
- name string
Returns:
-
Scene object
- application:set_scene (name)
-
Set current scene by the name.
Parameters:
- name string
- application:get_current_scene ()
-
Get current scene.
Returns:
-
Scene object
- application:update (dt)
-
Main update function.
Parameters:
- dt number
- application:render (dt)
-
Main render function.
Parameters:
- dt number
- application.resize (w, h)
-
Resize callback.
Parameters:
- w
- h
- application.mousemoved (x, y, dx, dy, istouch)
-
mousemoved callback.
Parameters:
- x
- y
- dx
- dy
- istouch
- application.wheelmoved (x, y)
-
wheelmoved callback.
Parameters:
- x
- y
- application.mousepressed (x, y, button)
-
mousepressed callback.
Parameters:
- x
- y
- button
- application.mousereleased (x, y, button)
-
mousereleased callback.
Parameters:
- x
- y
- button
- application.keypressed (key, scancode, isrepeat)
-
keypressed callback.
Parameters:
- key
- scancode
- isrepeat
- application.keyreleased (key, scancode, isrepeat)
-
keyreleased callback.
Parameters:
- key
- scancode
- isrepeat