Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/event/key_mapper.h @ 7637

Last change on this file since 7637 was 7637, checked in by bensch, 18 years ago

orxonox/trunk: keys added

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