mirror of
https://github.com/euphy/polargraphcontroller
synced 2025-01-09 19:55:16 +01:00
That's it.
This commit is contained in:
parent
4b10190eba
commit
f432ab4755
27
gamepad.pde
27
gamepad.pde
@ -5,6 +5,8 @@ ControllButton buttonA;
|
|||||||
ControllButton buttonB;
|
ControllButton buttonB;
|
||||||
ControllButton buttonX;
|
ControllButton buttonX;
|
||||||
ControllButton buttonY;
|
ControllButton buttonY;
|
||||||
|
ControllButton buttonL;
|
||||||
|
ControllButton buttonR;
|
||||||
|
|
||||||
ControllCoolieHat dpad;
|
ControllCoolieHat dpad;
|
||||||
|
|
||||||
@ -16,6 +18,8 @@ String signalFromGamepad = null;
|
|||||||
|
|
||||||
static final String BUTTON_A_RELEASED = "ButtonAReleased";
|
static final String BUTTON_A_RELEASED = "ButtonAReleased";
|
||||||
static final String BUTTON_B_RELEASED = "ButtonBReleased";
|
static final String BUTTON_B_RELEASED = "ButtonBReleased";
|
||||||
|
static final String BUTTON_L_RELEASED = "ButtonLReleased";
|
||||||
|
static final String BUTTON_R_RELEASED = "ButtonRReleased";
|
||||||
|
|
||||||
void gamepad_init()
|
void gamepad_init()
|
||||||
{
|
{
|
||||||
@ -31,12 +35,18 @@ void gamepad_init()
|
|||||||
buttonX = joypad.getButton("Button 2");
|
buttonX = joypad.getButton("Button 2");
|
||||||
buttonY = joypad.getButton("Button 3");
|
buttonY = joypad.getButton("Button 3");
|
||||||
|
|
||||||
|
buttonL = joypad.getButton("Button 4");
|
||||||
|
buttonR = joypad.getButton("Button 5");
|
||||||
|
|
||||||
buttonA.plug(this, "buttonARelease", ControllIO.ON_RELEASE);
|
buttonA.plug(this, "buttonARelease", ControllIO.ON_RELEASE);
|
||||||
buttonB.plug(this, "buttonBRelease", ControllIO.ON_RELEASE);
|
buttonB.plug(this, "buttonBRelease", ControllIO.ON_RELEASE);
|
||||||
buttonX.plug(this, "buttonXPress", ControllIO.ON_PRESS);
|
buttonX.plug(this, "buttonXPress", ControllIO.ON_PRESS);
|
||||||
buttonX.plug(this, "buttonXRelease", ControllIO.ON_RELEASE);
|
buttonX.plug(this, "buttonXRelease", ControllIO.ON_RELEASE);
|
||||||
buttonY.plug(this, "buttonYRelease", 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 = joypad.getCoolieHat(10);
|
||||||
dpad.setMultiplier(4);
|
dpad.setMultiplier(4);
|
||||||
dpad.plug(this, "dpadPress", ControllIO.ON_PRESS);
|
dpad.plug(this, "dpadPress", ControllIO.ON_PRESS);
|
||||||
@ -56,6 +66,14 @@ public void buttonBRelease()
|
|||||||
{
|
{
|
||||||
signalFromGamepad = BUTTON_B_RELEASED;
|
signalFromGamepad = BUTTON_B_RELEASED;
|
||||||
}
|
}
|
||||||
|
public void buttonLRelease()
|
||||||
|
{
|
||||||
|
signalFromGamepad = BUTTON_L_RELEASED;
|
||||||
|
}
|
||||||
|
public void buttonRRelease()
|
||||||
|
{
|
||||||
|
signalFromGamepad = BUTTON_R_RELEASED;
|
||||||
|
}
|
||||||
|
|
||||||
void buttonXPress()
|
void buttonXPress()
|
||||||
{
|
{
|
||||||
@ -132,7 +150,14 @@ void processGamepadInput()
|
|||||||
if (captureShape != null && !confirmedDraw)
|
if (captureShape != null && !confirmedDraw)
|
||||||
button_mode_liveConfirmDraw();
|
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
|
// clear the signal
|
||||||
signalFromGamepad = null;
|
signalFromGamepad = null;
|
||||||
|
@ -900,8 +900,6 @@ void displayGamepadOverlay()
|
|||||||
|
|
||||||
image(dpadXImage, width-600, height-400, 128, 128);
|
image(dpadXImage, width-600, height-400, 128, 128);
|
||||||
text("Filter short paths", width-600, height-420);
|
text("Filter short paths", width-600, height-420);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user