JNGL
Easy to use cross-platform 2D game library
|
Active state of the game, e.g. a menu or the game itself. More...
#include <jngl/work.hpp>
Public Member Functions | |
virtual void | onBackEvent () |
Gets called when the "back" button is pressed (important on Android) More... | |
virtual void | onQuitEvent () |
Gets called when the user closes the main window or quit() has been called. More... | |
virtual void | onControllerBack () |
Gets called when the "Back" button is pressed on any connected controller (Android only) More... | |
virtual void | onPauseEvent () |
Gets called when the main window loses focus or the app is put in the background. More... | |
virtual void | onLoad () |
Gets called when the Work is activated by App::mainLoop() | |
Public Member Functions inherited from Job | |
virtual void | step ()=0 |
Advance the game logic. More... | |
virtual void | draw () const =0 |
Draw the game state. More... | |
Job ()=default | |
Does nothing. | |
Job (const Job &)=default | |
Copy constructor. | |
Job & | operator= (const Job &)=default |
Copy assignment. | |
Job (Job &&)=default | |
Move constructor. | |
Job & | operator= (Job &&)=default |
Move assignment. | |
virtual | ~Job () |
Does nothing. | |
|
virtual |
Gets called when the "back" button is pressed (important on Android)
Calls onQuitEvent by default.
|
virtual |
Gets called when the user closes the main window or quit() has been called.
To continue with the main loop, call cancelQuit().
|
virtual |
Gets called when the "Back" button is pressed on any connected controller (Android only)
As the TV remote is registered as a controller this is important to handle Back on the TV remote. Most likely you won't need to overwrite this though, as it calls onBackEvent() by default and having Android's "Back" button to the same as "Back" on the TV remote is a good idea.
|
virtual |
Gets called when the main window loses focus or the app is put in the background.
On iOS and Android this will happen when the user switches to another app. As the main loop continues to run you might want to pause the game if necessary.