Dragonfly  4.3
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 
10 namespace df {
11 
12 const std::string UNDEFINED_STATE = "__undefined state__";
13 
14 class State {
15  private:
16  std::string m_state_type; /// Name of state.
17 
18  public:
19  State();
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
void setType(std::string new_type)
Set name of state.
virtual void Exit(Object *p_obj)
Invoked when state exited.
std::string getType() const
Get name of state.
A 2-d bounding box.
Definition: Box.h:10
Definition: State.h:14
virtual void Execute(Object *p_obj)=0
Invoked every game loop step.
Definition: Object.h:59
State()
Name of state.
virtual void Enter(Object *p_obj)
Invoked when state first entered.