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

A collection of models. More...

#include <gf/ModelContainer.h>

Public Member Functions

void update (float dt)
 Update the models. More...
 
void addModel (Model &model)
 Add a model to the collection. More...
 
ModelremoveModel (Model *model)
 Remove a model from the collection. More...
 

Detailed Description

A collection of models.

gf::ModelContainer represents a collection of models that are updated automatically.

The model manager is not responsible for the memory of the models. The models must be allocated by the user and not deleted while they are handled by the model manager.

Generally, you only need one model manager in your game. You create it at the beginning of the game and put all your models in it. Then you can call gf::ModelContainer::update() in your game loop.

See also
gf::Model

Member Function Documentation

void gf::ModelContainer::addModel ( Model model)

Add a model to the collection.

The model must not be deleted while it is handled by the model manager.

Parameters
modelA model
See also
removeModel()
Model* gf::ModelContainer::removeModel ( Model model)

Remove a model from the collection.

Parameters
modelThe model to remove
Returns
The removed model or nullptr if the model was not present
See also
addModel()
void gf::ModelContainer::update ( float  dt)

Update the models.

Parameters
dtThe time (in seconds) since the last update
See also
gf::Model::update()