Skip to content

Commit

Permalink
Merge pull request #101 from flamingchickens1540/issue-100
Browse files Browse the repository at this point in the history
Fix #100: Better support for XboxController
  • Loading branch information
RobinsonZ authored Dec 22, 2018
2 parents ccca37a + c036f04 commit 058d67b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.team1540.rooster.triggers;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.Button;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
Expand All @@ -10,7 +10,8 @@
* joystick.
*/
public class AxisButton extends Button {
private Joystick stick;

private GenericHID stick;
private double threshold;
private int axis;

Expand All @@ -22,7 +23,7 @@ public class AxisButton extends Button {
* @param threshold The threshold for the button to be triggered
* @throws NullPointerException If {@code stick} is {@code null}.
*/
public AxisButton(@NotNull Joystick stick, double threshold, int axis) {
public AxisButton(@NotNull GenericHID stick, double threshold, int axis) {
this.stick = Objects.requireNonNull(stick);
this.threshold = threshold;
this.axis = axis;
Expand Down
10 changes: 5 additions & 5 deletions lib/src/main/java/org/team1540/rooster/triggers/DPadButton.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.team1540.rooster.triggers;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.Button;
import java.util.Objects;
import org.jetbrains.annotations.Contract;
Expand All @@ -21,22 +21,22 @@ public enum DPadAxis {
UP, DOWN, LEFT, RIGHT
}

private Joystick stick;
private GenericHID stick;
private int pad;

private org.team1540.rooster.triggers.DPadAxis axis;

/**
* Constructs a {@link DPadButton}.
*
* @deprecated Use {@link #DPadButton(Joystick, int, org.team1540.rooster.triggers.DPadAxis)}
* @deprecated Use {@link #DPadButton(GenericHID, int, org.team1540.rooster.triggers.DPadAxis)}
*
* @param stick The joystick with the button.
* @param pad The ID of the d-pad.
* @param axis The axis of the button.
*/
@Deprecated
public DPadButton(Joystick stick, int pad, DPadAxis axis) {
public DPadButton(GenericHID stick, int pad, DPadAxis axis) {
super();
this.stick = stick;
this.pad = pad;
Expand Down Expand Up @@ -65,7 +65,7 @@ public DPadButton(Joystick stick, int pad, DPadAxis axis) {
* @throws NullPointerException If {@code stick} or {@code axis} is {@code null}.
* @throws IllegalArgumentException If {@code pad} is negative.
*/
public DPadButton(@NotNull Joystick stick, int pad,
public DPadButton(@NotNull GenericHID stick, int pad,
@NotNull org.team1540.rooster.triggers.DPadAxis axis) {
super();
if (pad < 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.team1540.rooster.triggers;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.Button;
import java.util.Objects;
import org.jetbrains.annotations.Contract;
Expand All @@ -11,7 +11,7 @@
*/
public class StrictDPadButton extends Button {

private Joystick stick;
private @NotNull GenericHID stick;
private int pad;

private DPadAxis axis;
Expand All @@ -25,7 +25,7 @@ public class StrictDPadButton extends Button {
* @throws NullPointerException If {@code stick} or {@code axis} is {@code null}.
* @throws IllegalArgumentException If {@code pad} is negative.
*/
public StrictDPadButton(@NotNull Joystick stick, int pad,
public StrictDPadButton(@NotNull GenericHID stick, int pad,
@NotNull org.team1540.rooster.triggers.DPadAxis axis) {
super();
if (pad < 0) {
Expand Down

0 comments on commit 058d67b

Please sign in to comment.