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 | class IniParser; |
---|
15 | |
---|
16 | //! A mapping from key-name to key-id |
---|
17 | typedef struct orxKeyMapping |
---|
18 | { |
---|
19 | int* pValue; |
---|
20 | char* pName; |
---|
21 | }; |
---|
22 | |
---|
23 | |
---|
24 | //! The map class functionalities |
---|
25 | class KeyMapper : public BaseObject { |
---|
26 | |
---|
27 | public: |
---|
28 | KeyMapper(); |
---|
29 | virtual ~KeyMapper(); |
---|
30 | |
---|
31 | void loadKeyBindings(const std::string& fileName = "" ); |
---|
32 | void loadKeyBindings(IniParser* iniParser); |
---|
33 | |
---|
34 | void debug(); |
---|
35 | |
---|
36 | private: |
---|
37 | int* nameToIndex (const std::string& name); |
---|
38 | void mapKeys(const std::string& name, int* index); |
---|
39 | |
---|
40 | public: |
---|
41 | static int PEV_FORWARD; //!< forward button |
---|
42 | static int PEV_BACKWARD; //!< backward buttton |
---|
43 | static int PEV_LEFT; //!< left button |
---|
44 | static int PEV_RIGHT; //!< right button |
---|
45 | static int PEV_UP; //!< up button |
---|
46 | static int PEV_DOWN; //!< down button |
---|
47 | |
---|
48 | static int PEV_ROLL_LEFT; //!< rolls left |
---|
49 | static int PEV_ROLL_RIGHT; //!< rolls right |
---|
50 | |
---|
51 | static int PEV_STRAFE_LEFT; //!< strafe left button |
---|
52 | static int PEV_STRAFE_RIGHT; //!< strafe right button |
---|
53 | |
---|
54 | static int PEV_FIRE1; //!< fire button 1 |
---|
55 | static int PEV_FIRE2; //!< fire button 2 |
---|
56 | static int PEV_PREVIOUS_WEAPON; //!< prev weapon button |
---|
57 | static int PEV_NEXT_WEAPON; //!< next weapon button |
---|
58 | |
---|
59 | static int PEV_CHANGE_SHIP; //!< The button to change the Ship. |
---|
60 | |
---|
61 | static int PEV_VIEW0; //!< view 0 button |
---|
62 | static int PEV_VIEW1; //!< view 1 button |
---|
63 | static int PEV_VIEW2; //!< view 2 button |
---|
64 | static int PEV_VIEW3; //!< view 3 button |
---|
65 | static int PEV_VIEW4; //!< view 4 button |
---|
66 | static int PEV_VIEW5; //!< view 5 button |
---|
67 | |
---|
68 | static int PEV_NEXT_WORLD; //!< next world button |
---|
69 | static int PEV_PREVIOUS_WORLD; //!< prev world button |
---|
70 | |
---|
71 | static int PEV_PAUSE; //!< pause button |
---|
72 | static int PEV_QUIT; //!< quit button |
---|
73 | |
---|
74 | private: |
---|
75 | int coord[2]; //!< temp place to save variables in nameToIndex() function |
---|
76 | }; |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | #endif /* _KEY_MAPPER_H */ |
---|