From f432ab475551e44dd1551eee0d4c34979c72b1fc Mon Sep 17 00:00:00 2001 From: Sandy Noble Date: Sun, 31 Mar 2013 22:03:59 +0100 Subject: [PATCH] That's it. --- gamepad.pde | 27 ++++++++++++++++++++++++++- polargraphcontroller_webcam.pde | 2 -- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/gamepad.pde b/gamepad.pde index fb0aba4..57b9f8c 100644 --- a/gamepad.pde +++ b/gamepad.pde @@ -5,6 +5,8 @@ ControllButton buttonA; ControllButton buttonB; ControllButton buttonX; ControllButton buttonY; +ControllButton buttonL; +ControllButton buttonR; ControllCoolieHat dpad; @@ -16,6 +18,8 @@ String signalFromGamepad = null; static final String BUTTON_A_RELEASED = "ButtonAReleased"; static final String BUTTON_B_RELEASED = "ButtonBReleased"; +static final String BUTTON_L_RELEASED = "ButtonLReleased"; +static final String BUTTON_R_RELEASED = "ButtonRReleased"; void gamepad_init() { @@ -31,12 +35,18 @@ void gamepad_init() buttonX = joypad.getButton("Button 2"); buttonY = joypad.getButton("Button 3"); + buttonL = joypad.getButton("Button 4"); + buttonR = joypad.getButton("Button 5"); + buttonA.plug(this, "buttonARelease", ControllIO.ON_RELEASE); buttonB.plug(this, "buttonBRelease", ControllIO.ON_RELEASE); buttonX.plug(this, "buttonXPress", ControllIO.ON_PRESS); buttonX.plug(this, "buttonXRelease", ControllIO.ON_RELEASE); buttonY.plug(this, "buttonYRelease", ControllIO.ON_RELEASE); + buttonL.plug(this, "buttonLRelease", ControllIO.ON_RELEASE); + buttonR.plug(this, "buttonRRelease", ControllIO.ON_RELEASE); + dpad = joypad.getCoolieHat(10); dpad.setMultiplier(4); dpad.plug(this, "dpadPress", ControllIO.ON_PRESS); @@ -56,6 +66,14 @@ public void buttonBRelease() { signalFromGamepad = BUTTON_B_RELEASED; } +public void buttonLRelease() +{ + signalFromGamepad = BUTTON_L_RELEASED; +} +public void buttonRRelease() +{ + signalFromGamepad = BUTTON_R_RELEASED; +} void buttonXPress() { @@ -132,7 +150,14 @@ void processGamepadInput() if (captureShape != null && !confirmedDraw) button_mode_liveConfirmDraw(); } - + else if (signalFromGamepad == BUTTON_L_RELEASED) + { + commandQueueRunning = !commandQueueRunning; + } + else if (signalFromGamepad == BUTTON_R_RELEASED) + { + cp5.tab(TAB_NAME_INPUT).setActive(true); + } // clear the signal signalFromGamepad = null; diff --git a/polargraphcontroller_webcam.pde b/polargraphcontroller_webcam.pde index 262ec5c..3a3fe50 100644 --- a/polargraphcontroller_webcam.pde +++ b/polargraphcontroller_webcam.pde @@ -900,8 +900,6 @@ void displayGamepadOverlay() image(dpadXImage, width-600, height-400, 128, 128); text("Filter short paths", width-600, height-420); - - } else {