-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGamepadXbox.cpp
More file actions
executable file
·58 lines (48 loc) · 1.48 KB
/
GamepadXbox.cpp
File metadata and controls
executable file
·58 lines (48 loc) · 1.48 KB
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
/*----------------------------------------------------------------------------*/
/* Copyright (c) TechForKid 2014. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#include "GamepadXbox.h"
/* --------------------------------------------------------------------------- */
// Constructors
/**
* Construct an instance of a GamepadXbox.
* The joystick index is the usb port on the drivers station.
*
* @param port The port on the driver station that the joystick is plugged into.
*/
GamepadXbox::GamepadXbox(UINT32 port)
: Joystick(port)
{
}
GamepadXbox::~GamepadXbox()
{
}
/* --------------------------------------------------------------------------- */
// Methods
/**
* Get the X value of the joystick in ENU - BODY format.
*/
float GamepadXbox::GetLeftX()
{
return -Joystick::GetRawAxis(2); // Pour retourner la valeur Y de la classe de base, mais de sens inverse
}
float GamepadXbox::GetLeftY()
{
return Joystick::GetRawAxis(1);
}
float GamepadXbox::GetRightX()
{
return -Joystick::GetRawAxis(5);
}
float GamepadXbox::GetRightY()
{
return Joystick::GetRawAxis(4);
}
float GamepadXbox::Trigger()
{
// Left Trigger goes from 0 to 1;
// Right Trigger goes from -1 to 0;
return Joystick::GetRawAxis(3);
}