Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MouseController.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: MouseController.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Joystick Input class
13 */
14 
15 #ifndef MouseController_h
16 #define MouseController_h
17 
18 #include "MotionController.h"
19 
20 // +--------------------------------------------------------------------+
21 
23 {
24 public:
25  static const char* TYPENAME() { return "MouseController"; }
26 
28  virtual ~MouseController();
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 0; }
38  virtual double Y() { return 0; }
39  virtual double Z() { return 0; }
40 
41  // rotations
42  virtual double Pitch() { if (active) return p; return 0; }
43  virtual double Roll() { if (active) return r; return 0; }
44  virtual double Yaw() { if (active) return w; return 0; }
45  virtual int Center() { return 0; }
46 
47  // throttle
48  virtual double Throttle() { if (active) return t; return 0; }
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);
54 
55  // actively sampling?
56  virtual bool Active() { return active; }
57  virtual void SetActive(bool a) { active = a; }
58 
59  static MouseController* GetInstance();
60 
61 protected:
62  double p,r,w, dx, dy, t;
64  int map[32];
65  bool active;
67 };
68 
69 #endif MouseController_h
70