Skip to content

Commit

Permalink
Make Xbox behave like BootlegXbox, add .flipped()
Browse files Browse the repository at this point in the history
  • Loading branch information
BenG49 committed Jan 8, 2024
1 parent ba65ff1 commit e9cb2e7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/com/stuypulse/stuylib/input/gamepads/Xbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ public class Xbox extends Gamepad {

private XboxController mJoystick;

private boolean flipped;

// Constructor //
public Xbox(XboxController joystick) {
mJoystick = joystick;

flipped = false;
}

public Xbox(int port) {
Expand All @@ -46,18 +50,18 @@ public double getLeftX() {

@Override
public double getLeftY() {
return getJoystick().getLeftY();
return -getJoystick().getLeftY();
}

// Right Stick //
@Override
public double getRightX() {
return getJoystick().getRightX();
return (flipped ? +1 : -1) * getJoystick().getRightX();
}

@Override
public double getRightY() {
return getJoystick().getRightY();
return (flipped ? +1 : -1) * getJoystick().getRightY();
}

// D-Pad //
Expand Down Expand Up @@ -152,4 +156,9 @@ public void setRumble(double intensity) {
mJoystick.setRumble(RumbleType.kLeftRumble, intensity);
mJoystick.setRumble(RumbleType.kRightRumble, intensity);
}

public Xbox flipped() {
flipped = true;
return this;
}
}

0 comments on commit e9cb2e7

Please sign in to comment.