Processing Forum
Processing result: 4244..Lost 256 ..Why?byte z1 = (byte)(4500>>8);byte z2 = (byte)(4500);int z3 = ((z1<<8)+ z2);println(z3);
At line 14..NoSuchAlgorithmException
But the problem is..What are the name and the parameters of the function i have to write?Automatic controller-event detection
ControlP5 offers a range of controllers that allow you to easily change and adjust values while your sketch is running. Each controller is identified by a unique name assigned when creating a controller. ControlP5 locates variables and functions inside your sketch and will link controllers to matching variables or functions automatically ControlP5toggle → example . Controller changes can easily be captured within your sketch by implementing the controlEvent function ControlP5controlEvent → example .
/** * ControlP5 Group * * * find a list of public methods available for the Group Controller * at the bottom of this sketch. * * by Andreas Schlegel, 2012 * www.sojamo.de/libraries/controlp5 * */ import controlP5.*; ControlP5 cp5; void setup() { size(700,400); cp5 = new ControlP5(this); Group g1 = cp5.addGroup("g1") .setPosition(100,100) .setBackgroundHeight(100) .setBackgroundColor(color(255,50)) ; cp5.addBang("A-1") .setPosition(10,20) .setSize(80,20) .setGroup(g1) ; cp5.addBang("A-2") .setPosition(10,60) .setSize(80,20) .setGroup(g1) ; Group g2 = cp5.addGroup("g2") .setPosition(300,100) .setWidth(300) .activateEvent(true) .setBackgroundColor(color(255,80)) .setBackgroundHeight(100) .setLabel("Hello World.") ; cp5.addSlider("S-1") .setPosition(80,10) .setSize(180,9) .setGroup(g2) ; cp5.addSlider("S-2") .setPosition(80,20) .setSize(180,9) .setGroup(g2) ; cp5.addRadioButton("radio") .setPosition(10,10) .setSize(20,9) .addItem("black",0) .addItem("red",1) .addItem("green",2) .addItem("blue",3) .addItem("grey",4) .setGroup(g2) ; } void draw() { background(0); } void controlEvent(ControlEvent theEvent) { if(theEvent.isGroup()) { println("got an event from group " +theEvent.group().name() +", isOpen? "+theEvent.group().isOpen() ); } else if (theEvent.isController()){ println("got something from a controller " +theEvent.controller().name() ); } } void keyPressed() { if(key==' ') { cp5.group("g1").remove(); } }
theEvent is a ControlEvent object. But in JavaDoc documentation http://www.sojamo.de/libraries/controlP5/reference/index.html i cannot see any group() function..where is it? What about the error i see when running this example?
Thanks :D