Gamedev Framework (gf)  0.4.0
A C++11 framework for 2D games
Public Member Functions | List of all members
gf::FixedTimestepModel Class Reference

Fixed timestep model. More...

#include <gf/Models.h>

Inheritance diagram for gf::FixedTimestepModel:
Inheritance graph

Public Member Functions

 FixedTimestepModel (Model &model, float timestep=1/60.0f)
 Constructor. More...
virtual void update (float dt) override
 Update the model's state. More...
- Public Member Functions inherited from gf::Model
virtual ~Model ()
 Destructor. More...

Detailed Description

Fixed timestep model.

This model takes another model that needs a fixed timestep and provides it event if the original timestep is not fixed. This may be useful for physics model, for example.

Constructor & Destructor Documentation

gf::FixedTimestepModel::FixedTimestepModel ( Model model,
float  timestep = 1/60.0f 


modelThe original model
timestepThe fixed timestep

Member Function Documentation

virtual void gf::FixedTimestepModel::update ( float  dt)

Update the model's state.

Models are updated each frame. The time between two frames is given as a parameter to help in the update. This time is in seconds.

dtThe time (in seconds) since the last update
See also

Reimplemented from gf::Model.