-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathEnhancedJoystick.h
34 lines (31 loc) · 964 Bytes
/
EnhancedJoystick.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef ENHANCED_JOYSTICK_H
#define ENHANCED_JOYSTICK_H
#include <vector>
#include <bitset>
#include <Joystick.h>
#include "Controls.h"
class EnhancedJoystick : public Joystick {
public:
static const float JOYSTICK_ZERO_TOLERANCE = 0.1;
static const float TRIGGER_TOLERANCE = 0.25;
typedef void* obj;
typedef void(*funcName)(obj);
void addBtn(UINT32,funcName,obj);
EnhancedJoystick(UINT32,void*);
~EnhancedJoystick();
void updateEJ();
static void updateEJHelper(obj);
bool GetRawButton(UINT32 btn);
bool IsAxisZero(unsigned int);
Trigger GetTriggerState();
private:
const static unsigned int NUMBUTTONS = 12;
const static unsigned int WAIT_TIME = 3; //total amount of checks
std::bitset<WAIT_TIME> buttons[NUMBUTTONS];
void callFunct(unsigned int);
std::vector<UINT32> btnNumbers;
std::vector<funcName> helpers;
std::vector<obj> objects;
std::vector<bool> previousState;
};
#endif