forked from FRC2994/TestProg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gamepad.h
59 lines (46 loc) · 1.22 KB
/
Gamepad.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef GAMEPAD_H_
#define GAMEPAD_H_
#include "Joystick.h"
#include <stdio.h>
class DriverStation;
/**
* Handle input from Logitech Dual Action Gamepad connected to the Driver
* Station.
*/
class Gamepad : public Joystick
{
public:
typedef enum
{
kLeftXAxis, kLeftYAxis, kRightXAxis, kRightYAxis
} AxisType;
typedef enum
{
kCenter, kUp, kUpLeft, kLeft, kDownLeft, kDown, kDownRight, kRight,
kUpRight
} DPadDirection;
Gamepad(UINT32 port);
~Gamepad();
float GetLeftX();
float GetLeftY();
float GetRightX();
float GetRightY();
float GetAxis(AxisType axis);
float GetRawAxis(UINT32 axis);
bool GetNumberedButton(unsigned buttonNumber);
bool GetLeftPush();
bool GetRightPush();
DPadDirection GetDPad();
protected:
static const UINT32 kLeftXAxisNum = 1;
static const UINT32 kLeftYAxisNum = 2;
static const UINT32 kRightXAxisNum = 3;
static const UINT32 kRightYAxisNum = 4;
static const UINT32 kDPadXAxisNum = 5;
static const UINT32 kDPadYAxisNum = 6;
static const unsigned kLeftAnalogStickButton = 11;
static const unsigned kRightAnalogStickButton = 12;
DriverStation *ap_ds;
UINT32 a_port;
};
#endif