Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Keyboard.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: Keyboard.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Keyboard Input class
13 */
14 
15 #ifndef Keyboard_h
16 #define Keyboard_h
17 
18 #include "MotionController.h"
19 
20 // +--------------------------------------------------------------------+
21 
22 class Keyboard : public MotionController
23 {
24 public:
25  static const char* TYPENAME() { return "Keyboard"; }
26 
27  Keyboard();
28  virtual ~Keyboard();
29 
30  // setup
31  virtual void MapKeys(KeyMapEntry* mapping, int nkeys);
32 
33  // sample the physical device
34  virtual void Acquire();
35 
36  // translations
37  virtual double X() { return x; }
38  virtual double Y() { return y; }
39  virtual double Z() { return z; }
40 
41  // rotations
42  virtual double Pitch() { return p; }
43  virtual double Roll() { return r; }
44  virtual double Yaw() { return w; }
45  virtual int Center() { return c; }
46 
47  // throttle
48  virtual double Throttle() { return t; }
49  virtual void SetThrottle(double throttle) { t = throttle; }
50 
51  // actions
52  virtual int Action(int n) { return action[n]; }
53  virtual int ActionMap(int n) { return KeyDownMap(n); }
54 
55  static bool KeyDown(int key);
56  static bool KeyDownMap(int key);
57  static void FlushKeys();
58 
59  static Keyboard* GetInstance();
60 
61 protected:
62  double x,y,z,p,r,w,t;
63  double p1, r1, w1;
64  int c;
66 
67  static int map[KEY_MAP_SIZE];
68  static int alt[KEY_MAP_SIZE];
69 };
70 
71 // +--------------------------------------------------------------------+
72 
73 #endif Keyboard_h
74