LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
DebouncedJoystick.h
1 #ifndef DEBOUNCED_JOYSTICK_H_
2 #define DEBOUNCED_JOYSTICK_H_
3 
4 #include "Joystick.h"
5 #include "../Logging/Loggable.h"
6 
10 class DebouncedJoystick : public Joystick, public Loggable
11 {
12 public:
13  DebouncedJoystick(UINT32 port, int nBtns, int nAxes);
15 
19  void Init();
20 
24  void Update();
25 
31  bool ButtonInBounds(int button);
32 
38  bool AxisInBounds(int axis);
39 
45  bool IsButtonJustPressed(int button);
46 
52  bool IsButtonJustReleased(int button);
53 
59  bool IsButtonDown(int button);
60 
66  bool WasButtonDown(int button);
67 
74  bool IsHatSwitchJustPressed(int axis, int direction);
75 
82  bool IsHatSwitchJustReleased(int axis, int direction);
83 
90  bool IsHatSwitchDown(int axis, int direction);
91 
98  bool WasHatSwitchDown(int axis, int direction);
99 
105  double GetRawAxisDelta(int axis);
106 
112  double GetLastAxis(int axis);
113 
118  int GetNumButtons();
119 
124  int GetNumAxes();
125 
130  UINT32 GetPort();
131 
132  void Log();
133 
134 private:
135  int m_num_buttons, m_num_axes;
136  bool* wasPressed;
137  bool* isPressed;
138  double* axisPrevValue;
139  double* axisValue;
140  UINT32 m_port;
141 };
142 
143 #endif