name
ControllDevice
import processing.opengl.*;

import procontroll.*;
import net.java.games.input.*;

ControllIO controllIO;
ControllDevice joypad;
ControllStick stick1;
ControllStick stick2;

float transX;
float transY;

void setup(){
  size(600,600,OPENGL);

  transX = width/2;
  transY = height/2;

  controllIO = ControllIO.getInstance(this);

  joypad = controllIO.getDevice("Logitech RumblePad 2 USB");
  joypad.plug(this, "handleButton1Press", ControllIO.ON_PRESS, 1);
  joypad.plug(this, "handleButton1Release", ControllIO.ON_RELEASE, 1);
  joypad.plug(this, "handleMovement", ControllIO.WHILE_PRESS, 0);

  stick1 = joypad.getStick(0);
  stick1.setMultiplier(PI);

  stick2 = joypad.getStick(1);
  stick2.setTolerance(0.06f);
  stick2.setMultiplier(0.05f);
}

void handleButton1Press(){
  fill(255,0,0);
  joypad.rumble(1);
}

void handleButton1Release(){
  fill(255);
}

void handleMovement(final float i_x,final float i_y){
  transX += i_x;
  transY += i_y;
}

void draw(){
  background(0);
  lights();
  translate(transX,transY,0);
  rotateX(stick2.getTotalY());
  rotateY(stick2.getTotalX());
  box(200);
}
description

The device class is for the communication with your input devices. A device consists of buttons and sliders, sliders can be grouped to sticks.

To react on button events you can plug methods, that are called when a button is pressed, released or while a button is pressed.

constructors
none available
methods
Use this method to close a device.
Use this method to get a Button.
Use this method to get a Button.
Returns the name of the device.
Returns the number of buttons of the device.
Returns the number of sliders of the device.
Returns the number of sticks of the device.
Use this method to get a Slider.
Use this method to get a Button.
Use this method to open a device.
i_intputDevice String: the name of the device that triggers the plug
Lists the available buttons of a device.
Lists the available sliders of a device.
Lists the available sticks of a device.
Use this method to set the tolerance for all sliders of the device.
usage
Web & Application
related