[4367] | 1 | /*! |
---|
| 2 | \file key_mapper.h |
---|
| 3 | \brief 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 | |
---|
[4452] | 15 | //! A mapping from key-name to key-id |
---|
[4400] | 16 | typedef struct orxKeyMapping |
---|
| 17 | { |
---|
| 18 | int* pValue; |
---|
[4402] | 19 | char* pName; |
---|
[4400] | 20 | }; |
---|
[4386] | 21 | |
---|
[4400] | 22 | |
---|
[4367] | 23 | //! The map class functionalities |
---|
| 24 | class KeyMapper : public BaseObject { |
---|
| 25 | |
---|
| 26 | public: |
---|
| 27 | KeyMapper(); |
---|
| 28 | virtual ~KeyMapper(); |
---|
| 29 | |
---|
[4454] | 30 | void loadKeyBindings(const char* fileName = DEFAULT_CONFIG_FILE); |
---|
[4368] | 31 | |
---|
[4389] | 32 | void debug(); |
---|
| 33 | |
---|
[4368] | 34 | private: |
---|
| 35 | int* nameToIndex (char* name); |
---|
[4402] | 36 | void mapKeys(char* name, int keyID); |
---|
[4368] | 37 | |
---|
| 38 | public: |
---|
[4452] | 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 |
---|
[4368] | 43 | |
---|
[4452] | 44 | static int PEV_STRAFE_LEFT; //!< strafe left button |
---|
| 45 | static int PEV_STRAFE_RIGHT; //!< strafe right button |
---|
[4368] | 46 | |
---|
[4452] | 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 |
---|
[4368] | 51 | |
---|
[4452] | 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 |
---|
[4368] | 58 | |
---|
[4452] | 59 | static int PEV_NEXT_WORLD; //!< next world button |
---|
| 60 | static int PEV_PREVIOUS_WORLD; //!< prev world button |
---|
[4410] | 61 | |
---|
[4452] | 62 | static int PEV_PAUSE; //!< pause button |
---|
| 63 | static int PEV_QUIT; //!< quit button |
---|
[4410] | 64 | |
---|
[4368] | 65 | private: |
---|
[4454] | 66 | Sint32 coord[2]; //!< temp place to save variables in nameToIndex() function |
---|
[4367] | 67 | }; |
---|
| 68 | |
---|
[4400] | 69 | |
---|
| 70 | |
---|
| 71 | |
---|
[4367] | 72 | #endif /* _KEY_MAPPER_H */ |
---|