-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinitState.h
More file actions
49 lines (42 loc) · 952 Bytes
/
FinitState.h
File metadata and controls
49 lines (42 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef FINITE_STATE_H
#define FINITE_STATE_H
#include <stdio.h>
class CContext;
class CState
{
public:
virtual void Active() = 0;
virtual void Update() = 0;
virtual void Exit() = 0;
virtual const char* GetName() = 0;
};
#define STATE(name) class CState_##name : public CState \
{ \
public: \
CState_##name():m_pContext(0){} \
CState_##name(CContext* c):m_pContext(c){} \
const char* GetName(){return #name;} \
void Active(); \
void Update(); \
void Exit(); \
protected: \
CContext* m_pContext; \
};
STATE(Wait)
STATE(Run)
STATE(RunStop)
/*
class CState_Wait
{
public:
CState_Wait():m_pContext(0){}
CState_Wait(CContext* c):m_pContext(c){}
const char* GetName(){return "Wait";}
void Active();
void Update();
void Exit();
protected:
CContext* m_pContext;
};
*/
#endif