From 880062888469ff4f303e05c05aacb12c4425a451 Mon Sep 17 00:00:00 2001 From: Finn Frankis Date: Wed, 31 Oct 2018 18:32:51 -0700 Subject: [PATCH] Change order of HSGamepad class --- build.gradle | 2 +- src/harkerrobolib/wrappers/HSGamepad.kt | 31 ++++++++++++++----------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index e4a519d..d1c71e0 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ def ROBOT_CLASS = "frc.robot.Robot" apply plugin: 'idea' -version = '3.0.2' +version = '4.0.0' sourceSets { main.java.srcDirs = ['src'] diff --git a/src/harkerrobolib/wrappers/HSGamepad.kt b/src/harkerrobolib/wrappers/HSGamepad.kt index 010e5fd..e6588aa 100644 --- a/src/harkerrobolib/wrappers/HSGamepad.kt +++ b/src/harkerrobolib/wrappers/HSGamepad.kt @@ -12,7 +12,10 @@ abstract class HSGamepad(port: Int, buttonStartPort: Int, buttonSelectPort: Int, buttonStickLeftPort: Int, buttonStickRightPort: Int, buttonBumperLeftPort: Int, buttonBumperRightPort: Int, - private val axisLeftX: Int, private val axisLeftY: Int, private val axisRightX: Int, private val axisRightY: Int) : Joystick(port) { + private val axisLeftX: Int, private val axisLeftY: Int, private val axisRightX: Int, private val axisRightY: Int) : + Joystick(port) { + + /** * Gets an instance of Button A * @return An instance of the button @@ -64,6 +67,19 @@ abstract class HSGamepad(port: Int, */ val buttonBumperRight: HSJoystickButton + init { + buttonA = HSJoystickButton(this, buttonAPort) + buttonB = HSJoystickButton(this, buttonBPort) + buttonX = HSJoystickButton(this, buttonXPort) + buttonY = HSJoystickButton(this, buttonYPort) + buttonStart = HSJoystickButton(this, buttonStartPort) + buttonSelect = HSJoystickButton(this, buttonSelectPort) + buttonStickLeft = HSJoystickButton(this, buttonStickLeftPort) + buttonStickRight = HSJoystickButton(this, buttonStickRightPort) + buttonBumperLeft = HSJoystickButton(this, buttonBumperLeftPort) + buttonBumperRight = HSJoystickButton(this, buttonBumperRightPort) + } + /** * Gets the X value being input to the left joystick. * @return the left X value @@ -175,17 +191,4 @@ abstract class HSGamepad(port: Int, */ val buttonBumperRightState: Boolean get() = buttonBumperRight.get() - - init { - buttonA = HSJoystickButton(this, buttonAPort) - buttonB = HSJoystickButton(this, buttonBPort) - buttonX = HSJoystickButton(this, buttonXPort) - buttonY = HSJoystickButton(this, buttonYPort) - buttonStart = HSJoystickButton(this, buttonStartPort) - buttonSelect = HSJoystickButton(this, buttonSelectPort) - buttonStickLeft = HSJoystickButton(this, buttonStickLeftPort) - buttonStickRight = HSJoystickButton(this, buttonStickRightPort) - buttonBumperLeft = HSJoystickButton(this, buttonBumperLeftPort) - buttonBumperRight = HSJoystickButton(this, buttonBumperRightPort) - } }