LRT13  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 
6 class DebouncedJoystick: public Joystick
7 {
8 public:
9  DebouncedJoystick(UINT32 port, int nBtns, int nAxes);
10  ~DebouncedJoystick();
11 
12  void Init();
13  void Update();
14 
15  bool ButtonInBounds(int button);
16  bool AxisInBounds(int axis);
17 
18  bool IsButtonJustPressed(int button);
19  bool IsButtonJustReleased(int button);
20  bool IsButtonDown(int button);
21  bool WasButtonDown(int button);
22 
23  bool IsHatSwitchJustPressed(int axis, int direction);
24  bool IsHatSwitchJustReleased(int axis, int direction);
25  bool IsHatSwitchDown(int axis, int direction);
26  bool WasHatSwitchDown(int axis, int direction);
27 
28  double GetRawAxisDelta(int axis);
29 
30 private:
31  int m_num_buttons, m_num_axes;
32  bool* wasPressed;
33  bool* isPressed;
34  double* axisPrevValue;
35  double* axisValue;
36 };
37 
38 #endif