This repository has been archived by the owner on Jan 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Divide GamepadWrapper into Logitech and Xbox classes
- Loading branch information
1 parent
81fe45a
commit 4871e73
Showing
3 changed files
with
126 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package harkerrobolib.wrappers; | ||
|
||
/** | ||
* Represents a standard Logitech controller. | ||
* @author Finn Frankis | ||
* @version 10/16/18 | ||
*/ | ||
public class LogitechGamepad extends GamepadWrapper { | ||
public static final int A = 2; | ||
public static final int B = 3; | ||
public static final int X = 1; | ||
public static final int Y = 4; | ||
public static final int SELECT = 9; | ||
public static final int START = 10; | ||
|
||
public static final int STICK_LEFT = 11; | ||
public static final int STICK_RIGHT = 12; | ||
|
||
public static final int BUMPER_LEFT = 5; | ||
public static final int BUMPER_RIGHT = 6; | ||
|
||
public static final int LEFT_X = 0; | ||
public static final int LEFT_Y = 1; | ||
public static final int RIGHT_X = 2; | ||
public static final int RIGHT_Y = 3; | ||
public static final int TRIGGER_LEFT = 7; | ||
public static final int TRIGGER_RIGHT = 8; | ||
|
||
public LogitechGamepad(int port) { | ||
super(port, | ||
A, B, X, Y, | ||
START, SELECT, | ||
STICK_LEFT, STICK_RIGHT, | ||
BUMPER_LEFT, BUMPER_RIGHT, | ||
LEFT_X, LEFT_Y, RIGHT_X, RIGHT_Y); | ||
} | ||
|
||
public double getLeftTrigger() { | ||
return (getRawButton(TRIGGER_LEFT) == true) ? 1 : 0; | ||
} | ||
|
||
public double getRightTrigger() { | ||
return (getRawButton(TRIGGER_RIGHT) == true) ? 1 : 0; | ||
} | ||
} |
Oops, something went wrong.