JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
WorkFactory Class Reference

Public Member Functions

 WorkFactory (std::function< std::shared_ptr< Work >()>)
 
- 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 onQuitEvent ()
 Gets called when the user closes the main window or quit() has been called.
 
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.
 
- Public Member Functions inherited from Job
 Job ()=default
 Does nothing.
 
 Job (const Job &)=default
 Copy constructor.
 
Joboperator= (const Job &)=default
 Copy assignment.
 
 Job (Job &&)=default
 Move constructor.
 
Joboperator= (Job &&)=default
 Move assignment.
 
virtual ~Job ()
 Does nothing.
 

Private Member Functions

void step () override
 Advance the game logic.
 
void draw () const override
 Draw the game state.
 
void onLoad () override
 Gets called when the Work is activated by App::mainLoop()
 

Detailed Description

Definition at line 10 of file WorkFactory.hpp.

Inheritance diagram for WorkFactory:
[legend]
Collaboration diagram for WorkFactory:
[legend]

Member Function Documentation

◆ step()

void step ( )
overrideprivatevirtual

Advance the game logic.

This function gets called 60 times per second or whatever has been set by setStepsPerSecond().

Note
JNGL's main loop calls all Jobs' step() functions before the active Work's step()

Implements Job.

◆ draw()

void draw ( ) const
overrideprivatevirtual

Draw the game state.

As it isn't garuanteed that this function is called as often as Job::step, you shouldn't change any game state in it.

Note
JNGL's main loop calls all Jobs' draw() functions after the active Work's draw()

Implements Job.

◆ onLoad()

void onLoad ( )
overrideprivatevirtual

Gets called when the Work is activated by App::mainLoop()

Reimplemented from Work.


The documentation for this class was generated from the following file: