| author | saiam |
| Sun, 07 Dec 2008 19:02:45 +0000 | |
| changeset 249 | 5647f58e37cd |
| parent 237 | 3d5465bcb67d |
| child 283 | 7540b0859579 |
| permissions | -rw-r--r-- |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
1 |
#ifndef INPUT_HH |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
2 |
#define INPUT_HH |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
3 |
|
| 221 | 4 |
#include <stdint.h> |
| 230 | 5 |
#include <ClanLib/Display/input_device.h> |
| 221 | 6 |
#include <ClanLib/Display/keys.h> |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
7 |
|
| 221 | 8 |
// const uint16_t INPUT_INTERVAL_MS = 20; |
9 |
||
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
10 |
enum PlayerInputBit {
|
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
11 |
INPUT_NONE = 0x0000, |
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
12 |
|
| 221 | 13 |
INPUT_AIM_UP = 0x0001, |
14 |
INPUT_AIM_DOWN = 0x0002, |
|
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
15 |
|
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
16 |
INPUT_MOVE_LEFT = 0x0004, |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
17 |
INPUT_MOVE_RIGHT = 0x0008, |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
18 |
|
| 221 | 19 |
INPUT_JUMP = 0x0010, |
20 |
INPUT_DIG = 0x0020, |
|
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
21 |
INPUT_SHOOT = 0x0040, |
| 237 | 22 |
INPUT_CHANGE_NEXT = 0x0080, |
23 |
INPUT_CHANGE_PREV = 0x0100, |
|
24 |
INPUT_ROPE = 0x0200, |
|
25 |
INPUT_UNROPE = 0x0400, |
|
26 |
INPUT_ROPE_UP = 0x0800, |
|
27 |
INPUT_ROPE_DOWN = 0x1000, |
|
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
28 |
}; |
|
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
29 |
|
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
30 |
enum GuiInputBit {
|
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
31 |
GUI_INPUT_QUIT = 0x0001, |
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
32 |
GUI_INPUT_DISPLAY_WEAPON = 0x0002, |
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
33 |
GUI_INPUT_DEBUG_PLAYER = 0x0004, |
| 221 | 34 |
}; |
35 |
||
|
233
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
36 |
typedef uint16_t PlayerInput; |
|
ff4ecea83cf5
start using CL_ResourceManager, change most draw methods to take a Graphics*, implment even better input handling, and draw weapon names
terom
parents:
230
diff
changeset
|
37 |
typedef uint16_t GuiInput; |
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
38 |
|
| 235 | 39 |
template <typename BitEnumType> struct InputKeymapEntry; |
40 |
||
41 |
class Input {
|
|
42 |
protected: |
|
43 |
CL_InputDevice &keyboard; |
|
44 |
||
45 |
public: |
|
46 |
Input (CL_InputDevice &keyboard); |
|
47 |
||
48 |
private: |
|
49 |
bool checkKeycode (int keycode); |
|
50 |
template <typename BitEnumType, typename BitMaskType> BitMaskType buildMask (InputKeymapEntry<BitEnumType> *keymap); |
|
51 |
||
52 |
public: |
|
53 |
/* |
|
54 |
* Reads the keyboard to determine current state of the Player/Gui input |
|
55 |
*/ |
|
56 |
PlayerInput readPlayerInput (void); |
|
57 |
GuiInput readGuiInput (void); |
|
58 |
}; |
|
| 230 | 59 |
|
|
185
25becd2cb026
that's not a prototype anymore... at least it shouldn't be
terom
parents:
diff
changeset
|
60 |
#endif |