1 | /*! |
---|
2 | \file key_mapper.h |
---|
3 | * a construct to map player defined keys to SDL keys |
---|
4 | |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _KEY_MAPPER_H |
---|
8 | #define _KEY_MAPPER_H |
---|
9 | |
---|
10 | |
---|
11 | #include "base_object.h" |
---|
12 | #include "event_def.h" |
---|
13 | |
---|
14 | |
---|
15 | //! A mapping from key-name to key-id |
---|
16 | typedef struct orxKeyMapping |
---|
17 | { |
---|
18 | int* pValue; |
---|
19 | char* pName; |
---|
20 | }; |
---|
21 | |
---|
22 | |
---|
23 | //! The map class functionalities |
---|
24 | class KeyMapper : public BaseObject { |
---|
25 | |
---|
26 | public: |
---|
27 | KeyMapper(); |
---|
28 | virtual ~KeyMapper(); |
---|
29 | |
---|
30 | void loadKeyBindings(const char* fileName = DEFAULT_CONFIG_FILE); |
---|
31 | |
---|
32 | void debug(); |
---|
33 | |
---|
34 | private: |
---|
35 | int* nameToIndex (char* name); |
---|
36 | void mapKeys(char* name, int keyID); |
---|
37 | |
---|
38 | public: |
---|
39 | static int PEV_UP; //!< up button |
---|
40 | static int PEV_DOWN; //!< down buttton |
---|
41 | static int PEV_LEFT; //!< left button |
---|
42 | static int PEV_RIGHT; //!< right button |
---|
43 | |
---|
44 | static int PEV_STRAFE_LEFT; //!< strafe left button |
---|
45 | static int PEV_STRAFE_RIGHT; //!< strafe right button |
---|
46 | |
---|
47 | static int PEV_FIRE1; //!< fire button 1 |
---|
48 | static int PEV_FIRE2; //!< fire button 2 |
---|
49 | static int PEV_PREVIOUS_WEAPON; //!< prev weapon button |
---|
50 | static int PEV_NEXT_WEAPON; //!< next weapon button |
---|
51 | |
---|
52 | static int PEV_VIEW0; //!< view 0 button |
---|
53 | static int PEV_VIEW1; //!< view 1 button |
---|
54 | static int PEV_VIEW2; //!< view 2 button |
---|
55 | static int PEV_VIEW3; //!< view 3 button |
---|
56 | static int PEV_VIEW4; //!< view 4 button |
---|
57 | static int PEV_VIEW5; //!< view 5 button |
---|
58 | |
---|
59 | static int PEV_NEXT_WORLD; //!< next world button |
---|
60 | static int PEV_PREVIOUS_WORLD; //!< prev world button |
---|
61 | |
---|
62 | static int PEV_PAUSE; //!< pause button |
---|
63 | static int PEV_QUIT; //!< quit button |
---|
64 | |
---|
65 | private: |
---|
66 | Sint32 coord[2]; //!< temp place to save variables in nameToIndex() function |
---|
67 | }; |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | #endif /* _KEY_MAPPER_H */ |
---|