Abstract base class for game states.
More...
#include <ApplicationState.hpp>
|
| ApplicationState (ApplicationState *parent=nullptr) |
| Default constructor. More...
|
|
| ApplicationState (ApplicationState &&)=default |
| Defaulted move constructor. More...
|
|
virtual | ~ApplicationState ()=default |
| Virtual destructor. More...
|
|
ApplicationState & | operator= (ApplicationState &&)=default |
| Defaulted move assignment operator. More...
|
|
virtual void | onEvent (const SDL_Event &) |
| Do an action in response to an SDL event. More...
|
|
virtual void | update ()=0 |
| Execute actions every game tick. More...
|
|
ApplicationState * | parent () |
| Get the parent of this state. More...
|
|
void | setStateStack (ApplicationStateStack *stateStack) |
| Change the stack this state belongs to. More...
|
|
virtual | ~IDrawable ()=default |
| Virtual destructor. More...
|
|
virtual | ~Transformable ()=default |
|
void | setPosition (float x, float y, float z=0) |
|
void | setPosition (const Vector3f &position) |
|
void | setOrigin (float x, float y, float z=0) |
|
void | setOrigin (const Vector3f &origin) |
|
void | setScale (float factorX, float factorY, float factorZ=1) |
|
void | setScale (const Vector3f &factors) |
|
void | setRotation (float angle) |
|
void | setRotation (float angle, const Vector3f &axis) |
|
const Vector3f & | getPosition () const |
|
const Vector3f & | getOrigin () const |
|
const Vector3f & | getScale () const |
|
float | getRotation () const |
|
void | move (float offsetX, float offsetY, float offsetZ=0) |
|
void | move (const Vector3f &offset) |
|
void | scale (float factorX, float factorY, float factorZ=1) |
|
void | scale (const Vector3f &factor) |
|
void | rotate (float angle) |
|
void | rotate (float angle, const Vector3f &axis) |
|
const Transform & | getTransform () const |
|
Abstract base class for game states.
gk::ApplicationState is a very simple base class for designing your own game states.
Example:
public:
...
}
...
}
private:
...
}
...
};
- See also
- gk::ApplicationStateStack
Definition at line 30 of file ApplicationState.hpp.
§ ApplicationState() [1/2]
Default constructor.
- Parameters
-
parent | The parent of this state |
Definition at line 38 of file ApplicationState.hpp.
§ ApplicationState() [2/2]
Defaulted move constructor.
§ ~ApplicationState()
virtual gk::ApplicationState::~ApplicationState |
( |
| ) |
|
|
virtualdefault |
§ draw()
|
inlineoverrideprotectedvirtual |
Draw the sprite to a render target.
- Parameters
-
target | Render target to draw to |
states | Current render states |
Implements gk::IDrawable.
Definition at line 99 of file ApplicationState.hpp.
§ onEvent()
virtual void gk::ApplicationState::onEvent |
( |
const SDL_Event & |
| ) |
|
|
inlinevirtual |
Do an action in response to an SDL event.
- Parameters
-
event | The event sent from SDL |
Definition at line 64 of file ApplicationState.hpp.
§ operator=()
Defaulted move assignment operator.
§ parent()
Get the parent of this state.
- Returns
- The parent of this state
Definition at line 81 of file ApplicationState.hpp.
§ setStateStack()
Change the stack this state belongs to.
- Parameters
-
stateStack | The new state stack |
Definition at line 89 of file ApplicationState.hpp.
§ update()
virtual void gk::ApplicationState::update |
( |
| ) |
|
|
pure virtual |
Execute actions every game tick.
This is a pure virtual function that has to be implemented by the derived class to define what the state should do.
§ m_parent
§ m_stateStack
The documentation for this class was generated from the following file: