Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/util/event/key_mapper.h @ 4402

Last change on this file since 4402 was 4402, checked in by patrick, 19 years ago

orxonox/trunk: key mapping works just fine

File size: 1.2 KB
Line 
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
15
16//! Key aliasing structure
17/**
18   This structure contains the key aliasing information, e.g. the command strings that
19   have been bound to the keys.
20*/
21typedef struct
22{
23  char keys[N_STD_KEYS][CMD_LENGHT];
24  char buttons[N_BUTTONS][CMD_LENGHT];
25} KeyBindings;
26
27typedef struct orxKeyMapping
28{
29  int* pValue;
30  char* pName;
31};
32
33
34//! The map class functionalities
35class KeyMapper : public BaseObject {
36
37 public:
38  KeyMapper();
39  virtual ~KeyMapper();
40
41  void loadKeyBindings(const char* fileName = "~/.orxonox/orxonox.conf");
42
43  void debug();
44
45 private:
46  int* nameToIndex (char* name);
47  void mapKeys(char* name, int keyID);
48
49 public:
50  static int PEV_UP;
51  static int PEV_DOWN;
52  static int PEV_LEFT;
53  static int PEV_RIGHT;
54 
55  static int PEV_STRAFE_LEFT;
56  static int PEV_STRAFE_RIGHT;
57 
58  static int PEV_FIRE1;
59  static int PEV_FIRE2;
60
61  static int PEV_VIEW0;
62  static int PEV_VIEW1;
63  static int PEV_VIEW2;
64  static int PEV_VIEW3;
65  static int PEV_VIEW4;
66  static int PEV_VIEW5;
67
68 private:
69  KeyBindings* keyAliases;
70  Sint32 coord[2];
71};
72
73
74
75
76#endif /* _KEY_MAPPER_H */
Note: See TracBrowser for help on using the repository browser.