-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGameConfig.h
More file actions
58 lines (44 loc) · 947 Bytes
/
GameConfig.h
File metadata and controls
58 lines (44 loc) · 947 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
50
51
52
53
54
55
56
57
58
#ifndef _KICKITUP_GAMECONFIG_H
#define _KICKITUP_GAMECONFIG_H
#include <algorithm>
using std::max;
using std::min;
enum ePlayer
{
eP_Min,
eP_1 = eP_Min,
eP_2,
eP_Max
};
struct stStepSpeed {
int step;
public:
void set(const int speed = 1) {
step = speed;
}
int getMax() const {
int ret = step;
return ret;
}
int getMin() const {
int ret = step;
return ret;
}
void setRandom() {
step = 1+rand() % 8;
}
};
class GameConfig
{
private:
bool m_bStart[eP_Max]; // 1p 2p
stStepSpeed m_StepSpped[eP_Max];
public:
GameConfig(void);
~GameConfig(void);
bool IsStarted( const ePlayer p ) const { return m_bStart[p]; }
void SetStart( const ePlayer p, const bool bStart = true ) { m_bStart[p] = bStart; }
void SetSpeed( const ePlayer p, const int spped ) { m_StepSpped[p].set(spped); }
};
extern GameConfig g_GameConfig;
#endif // _KICKITUP_GAMECONFIG_H