Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/event/key_mapper.h @ 10771

Last change on this file since 10771 was 10698, checked in by snellen, 18 years ago

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

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