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