name
ControllStick
import procontroll.*;
import java.io.*;

ControllIO controll;
ControllDevice device;
ControllStick stick;
ControllButton button;

void setup(){
  size(400,400);
  
  controll = ControllIO.getInstance(this);

  device = controll.getDevice("Logitech RumblePad 2 USB");
  device.printSticks();
  device.setTolerance(0.05f);
  
  ControllSlider sliderX = device.getSlider("X-Achse");
  ControllSlider sliderY = device.getSlider("Y-Achse");
  
  stick = new ControllStick(sliderX,sliderY);
  
  button = device.getButton("Taste 0");
  
  fill(0);
  rectMode(CENTER);
}

float totalX = width/2;
float totalY = height/2;

void draw(){
  background(255);
  
  if(button.pressed()){
    fill(255,0,0);
  }else{
    fill(0);
  }
  
  totalX = constrain(totalX + stick.getX(),10,width-10);
  totalY = constrain(totalY + stick.getY(),10,height-10);
  
  rect(totalX,totalY,20,20);
}
description
A Stick combines two Sliders to a joy stick with x and y values. This class is for simpler handling of sliders belonging together. For detailed controll like different multipliers for the different axes of the stick work with the Sliders instead.
Note that this class is quiet experimental as it is only tested with my joypad and correct function extremly depends on the order of the sliders for a device. If the getStick ( ) function of ControllDevice gives you wrong sticks, you can initialize your own by giving it your own sliders.
constructors
ControllStick(i_xSlider, i_ySlider);
parameters
i_xSlider
ControllSlider, the slider for the x axis
i_ySlider
ControllSlider, the slider for the y axis
methods
Use this method to get the actual multiplier.
Returns the name of the stick. The sticks name is the combination of the names of its sliders.
Use this method to get the tolerance value.
Use this method to get the total x value of a stick.
Use this method to get the total y value of a stick.
The current x value of the stick.
The current y value of the stick.
Use this method to set the totalvalue to 0.
Use this method to set the actual multiplier.
Use this method to set the tolerance.
usage
application
related