|
JNGL
Easy to use cross-platform 2D game library
|
Fades between two scenes, first fading to jngl::getBackgroundColor() and then fading to the new scene. More...
#include <jngl/Fade.hpp>
Public Member Functions | |
| Fade (std::shared_ptr< Scene >, int speed=20) | |
| Fade (std::function< std::shared_ptr< Scene >()> factory, int speed=20) | |
| Uses factory() to get the new Scene when the screen has faded to black (or the background color). | |
| void | step () override |
| Advance the game logic. | |
| void | draw () const override |
| Draw the game state. | |
Public Member Functions inherited from Work | |
| virtual void | onBackEvent () |
Gets called on Android's "back" gesture or when the Esc key is pressed. | |
| virtual void | onControllerBack () |
| Gets called when the "Back" button is pressed on any connected controller (Android only) | |
| virtual void | onPauseEvent () |
| Gets called when the main window loses focus or the app is put in the background. | |
| virtual void | onLoad () |
| Gets called when the Work is activated by the main loop. | |
| virtual void | onUnload () |
| Gets called when the Work is deactivated by the main loop. | |
Public Member Functions inherited from Job | |
| virtual void | onFileDrop (const std::filesystem::path &) |
| Called when a file has been dropped onto the window. | |
| virtual void | onControllersChanged () |
| Whenever the return value of jngl::getConnectedControllers would change, this method gets called. | |
| 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. | |
Private Member Functions | |
| void | onQuitEvent () override |
| Gets called when the user closes the main window or quit() has been called. | |
Fades between two scenes, first fading to jngl::getBackgroundColor() and then fading to the new scene.
|
explicit |
Uses factory() to get the new Scene when the screen has faded to black (or the background color).
This is useful when the ctor of your new Scene might take a long time (e.g. loading assets) and you don't want the lag to be noticable.
|
overridevirtual |
Advance the game logic.
This function gets called 60 times per second or whatever has been set by setStepsPerSecond().
Implements Job.
|
overridevirtual |
|
overrideprivatevirtual |
Gets called when the user closes the main window or quit() has been called.
To continue with the main loop, call cancelQuit(). For example if you want to switch to a pause menu instead of exiting the game:
Reimplemented from Work.