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 _KEYBOARD_CONTROLLER_H
#define _KEYBOARD_CONTROLLER_H
#include "Controller.h"
#include "types.h"
// Compatible with glut values
typedef enum
{
KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T,
KEY_U, KEY_V, KEY_W, KEY_X, KEY_Y,
KEY_Z,
KEY_0, KEY_1, KEY_2, KEY_3,
KEY_4, KEY_5, KEY_6, KEY_7, KEY_8,
KEY_9,
KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT
} KeyCode;
class MainWindow;
class KeyboardController :
public Controller
{
typedef enum
{
NO_MOVE,
MOVE_LEFT,
MOVE_RIGHT
} NextMove;
public:
KeyboardController(Player& player, uint leftKey, uint rightKey);
virtual ~KeyboardController(void);
public:
void PressKey(KeyCode key);
void think();
void reset();
private:
const uint m_leftKey;
const uint m_rightKey;
NextMove m_nextMove;
};
#endif
|