Gamedev Framework (gf)
0.3.0
A C++11 framework for 2D games
|
A game entity. More...
#include <gf/Entity.h>
Public Member Functions | |
Entity (int priority=0) | |
Contructor. More... | |
virtual | ~Entity () |
Destructor. More... | |
int | getPriority () const |
Get the priority of the entity. More... | |
virtual void | update (float dt) |
Update the entity's state. More... | |
virtual void | render (RenderTarget &target) |
Render the entity. More... | |
Entity liveness | |
bool | isAlive () const |
Check if the entity is alive. More... | |
void | setAlive () |
Set the entity alive (again) More... | |
void | kill () |
Kill an entity. More... | |
A game entity.
gf::Entity represents a game entity, i.e. an object that is updated and rendered every frame.
Entities are ordered by priority when they are renderer, with lower priority being rendered first and higher priority being renderered last. The default priority is \( 0 \).
Entities can become dead, in which case they are neither updated nor rendered anymore.
Entities can be grouped in an gf::EntityContainer.
|
inline |
Contructor.
By default, the entity is alive.
priority | the priority of the entity (default: 0) |
|
virtual |
Destructor.
|
inline |
Get the priority of the entity.
|
inline |
|
inline |
Kill an entity.
This function kills the entity. After being killed, the entity must not be updated or rendered.
|
virtual |
|
inline |
Set the entity alive (again)
This function can be called to revive an entity that has been killed.
|
virtual |
Update the entity's state.
Entities are updated each frame. The time between two frames is given as a parameter to help in the update. This time is in seconds.
dt | The time (in seconds) since the last update |