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

Background job which stays part of the main loop independent of the active jngl::Work. More...

#include <jngl/job.hpp>

Public Member Functions

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.
 
Joboperator= (const Job &)=default
 Copy assignment.
 
 Job (Job &&)=default
 Move constructor.
 
Joboperator= (Job &&)=default
 Move assignment.
 
virtual ~Job ()
 Does nothing.
 

Detailed Description

Background job which stays part of the main loop independent of the active jngl::Work.

This can be used for an achievement system for example. Override this class and use jngl::addJob to register it.

Definition at line 16 of file job.hpp.

Inheritance diagram for Job:
[legend]

Member Function Documentation

◆ step()

virtual void step ( )
pure virtual

Advance the game logic.

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

◆ draw()

virtual void draw ( ) const
pure virtual

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.


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