Dragonfly 4.20
A text-based game engine
State.h
1///
2/// State.h
3///
4
5#ifndef __STATE_H__
6#define __STATE_H__
7
8#include "Object.h"
9
10namespace df {
11
12const std::string UNDEFINED_STATE = "__undefined state__";
13
14class State {
15 private:
16 std::string m_state_type; /// Name of state.
17
18 public:
20 virtual ~State();
21
22 /// Set name of state.
23 void setType(std::string new_type);
24
25 /// Get name of state.
26 std::string getType() const;
27
28 /// Invoked when state first entered.
29 virtual void Enter(Object *p_obj);
30
31 /// Invoked every game loop step.
32 virtual void Execute(Object *p_obj)=0;
33
34 /// Invoked when state exited.
35 virtual void Exit(Object *p_obj);
36};
37
38} // end of namespace df
39#endif
Definition: Object.h:57
Definition: State.h:14
virtual void Enter(Object *p_obj)
Invoked when state first entered.
std::string getType() const
Get name of state.
State()
Name of state.
virtual void Exit(Object *p_obj)
Invoked when state exited.
void setType(std::string new_type)
Set name of state.
virtual void Execute(Object *p_obj)=0
Invoked every game loop step.
An animation for a sprite.
Definition: Animation.h:15