New Super Mario Bros. U Headers
Loading...
Searching...
No Matches
StateMgr.h
Go to the documentation of this file.
1#pragma once
2
3#include <state/StateMethod.h>
4
5#define STATE_MGR_BASE_BODY(CLASS, METHOD)
6 public:
7 CLASS(T& obj, const StateID& state_id)
8 : mFactory(obj)
9 , mMethod(mFactory, state_id)
10 {
11 }
12
13 virtual ~CLASS()
14 {
15 }
16
17 void executeState()
18 {
19 mMethod.executeStateMethod();
20 }
21
22 void changeState(const StateID& state_id)
23 {
24 mMethod.changeStateMethod(state_id);
25 }
26
27 IState* getState() const
28 {
29 return mMethod.getState();
30 }
31
32 const StateID* getNewStateID() const
33 {
34 return mMethod.getNewStateID();
35 }
36
37 const StateID* getStateID() const
38 {
39 return mMethod.getStateID();
40 }
41
42 const StateID* getOldStateID() const
43 {
44 return mMethod.getOldStateID();
45 }
46
47 protected:
48 Factory<T> mFactory;
49 METHOD mMethod;
50
51template <typename T, template <typename FactoryT> class Factory>
53{
54 STATE_MGR_BASE_BODY(StateMgr, StateMethod)
55};
#define STATE_MGR_BASE_BODY(CLASS, METHOD)
Definition StateMgr.h:5
Definition StateMgr.h:53