version_essai
This commit is contained in:
commit
daf76be8d7
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Sat Feb 09 13:59:46 CET 2019
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=177
|
||||
controller.pictureframe.position.x=76
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=969696
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=/home/fredervish/Documents/lov-polargraph/2_dessins-imprimer/theo-portrait-2.svg
|
||||
controller.window.width=1607
|
||||
controller.frame.colour=C80000
|
||||
controller.image.position.y=588
|
||||
controller.image.position.x=131
|
||||
machine.motors.accel=250
|
||||
controller.image.height=394
|
||||
controller.machine.serialport=32
|
||||
controller.window.height=439
|
||||
controller.maxSegmentLength=2
|
||||
controller.geomerative.polygonizerLength=1
|
||||
machine.penlift.up=17
|
||||
machine.penlift.down=93
|
||||
controller.page.position.y=150
|
||||
controller.vector.scaling=20.6
|
||||
controller.page.position.x=364
|
||||
controller.pictureframe.width=570
|
||||
machine.step.multiplier=2
|
||||
controller.grid.size=93.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=DCDCDC
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=394
|
||||
machine.motors.stepsPerRev=200.5
|
||||
machine.pen.size=1
|
||||
controller.page.width=297
|
||||
controller.pixel.mask.color=958341
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=1025
|
||||
controller.geomerative.polygonizer=1
|
||||
controller.page.height=420
|
||||
controller.vector.position.y=-135.74
|
||||
controller.background.colour=646464
|
||||
controller.image.filename=
|
||||
controller.vector.position.x=-387.4
|
||||
controller.homepoint.y=150
|
||||
controller.guide.colour=FFFFFF
|
||||
machine.motors.maxSpeed=250
|
||||
controller.homepoint.x=512
|
||||
controller.density.preview.style=3
|
||||
controller.pixel.scaling=3.14
|
||||
controller.densitypreview.colour=000000
|
||||
machine.height=900
|
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Sun Dec 16 16:41:04 CET 2018
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=
|
||||
controller.pictureframe.position.x=
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=
|
||||
controller.window.width=
|
||||
controller.frame.colour=
|
||||
controller.image.position.y=
|
||||
controller.image.position.x
|
||||
machine.motors.accel=250
|
||||
controller.image.height=
|
||||
controller.machine.serialport=
|
||||
controller.window.height=
|
||||
controller.maxSegmentLength=
|
||||
controller.geomerative.polygonizerLength=2
|
||||
machine.penlift.up=17
|
||||
machine.penlift.down=93
|
||||
controller.page.position.y=150
|
||||
controller.vector.scaling=50.0
|
||||
controller.page.position.x=
|
||||
controller.pictureframe.width=
|
||||
machine.step.multiplier=2
|
||||
controller.grid.size=18.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=
|
||||
machine.motors.stepsPerRev=200
|
||||
machine.pen.size=4.05
|
||||
controller.page.width=708
|
||||
controller.pixel.mask.color=
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=708
|
||||
controller.geomerative.polygonizer=
|
||||
controller.page.height=730
|
||||
controller.vector.position.y=
|
||||
controller.background.colour=
|
||||
controller.image.filename=
|
||||
controller.vector.position.x=
|
||||
controller.homepoint.y=150
|
||||
controller.guide.colour=
|
||||
machine.motors.maxSpeed=500
|
||||
controller.homepoint.x=354
|
||||
controller.density.preview.style=
|
||||
controller.pixel.scaling=
|
||||
controller.densitypreview.colour=
|
||||
machine.height=1097
|
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Sun Dec 16 15:48:38 CET 2018
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=177
|
||||
controller.pictureframe.position.x=76
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=969696
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=/home/fredervish/Bureau/Heckert_GNU_white.svg
|
||||
controller.window.width=1335
|
||||
controller.frame.colour=C80000
|
||||
controller.image.position.y=588
|
||||
controller.image.position.x=131
|
||||
machine.motors.accel=250
|
||||
controller.image.height=394
|
||||
controller.machine.serialport=32
|
||||
controller.window.height=34
|
||||
controller.maxSegmentLength=2
|
||||
controller.geomerative.polygonizerLength=1
|
||||
machine.penlift.up=17
|
||||
machine.penlift.down=93
|
||||
controller.page.position.y=120
|
||||
controller.vector.scaling=42.1
|
||||
controller.page.position.x=0
|
||||
controller.pictureframe.width=570
|
||||
machine.step.multiplier=2
|
||||
controller.grid.size=93.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=DCDCDC
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=394
|
||||
machine.motors.stepsPerRev=200.5
|
||||
machine.pen.size=1
|
||||
controller.page.width=708
|
||||
controller.pixel.mask.color=958341
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=708
|
||||
controller.geomerative.polygonizer=1
|
||||
controller.page.height=978
|
||||
controller.vector.position.y=-198.02
|
||||
controller.background.colour=646464
|
||||
controller.image.filename=/home/fredervish/Documents/lov-polargraph/2_dessins-imprimer/Common_Kingfisher_Alcedo_atthis.jpg
|
||||
controller.vector.position.x=-700.27
|
||||
controller.homepoint.y=120
|
||||
controller.guide.colour=FFFFFF
|
||||
machine.motors.maxSpeed=500
|
||||
controller.homepoint.x=354
|
||||
controller.density.preview.style=3
|
||||
controller.pixel.scaling=3.14
|
||||
controller.densitypreview.colour=000000
|
||||
machine.height=1097
|
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Sun Dec 16 16:41:04 CET 2018
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=177
|
||||
controller.pictureframe.position.x=76
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=969696
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=
|
||||
controller.window.width=1287
|
||||
controller.frame.colour=C80000
|
||||
controller.image.position.y=588
|
||||
controller.image.position.x=131
|
||||
machine.motors.accel=250
|
||||
controller.image.height=394
|
||||
controller.machine.serialport=32
|
||||
controller.window.height=-80
|
||||
controller.maxSegmentLength=2
|
||||
controller.geomerative.polygonizerLength=1
|
||||
machine.penlift.up=17
|
||||
machine.penlift.down=93
|
||||
controller.page.position.y=150
|
||||
controller.vector.scaling=42.1
|
||||
controller.page.position.x=0
|
||||
controller.pictureframe.width=570
|
||||
machine.step.multiplier=2
|
||||
controller.grid.size=93.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=DCDCDC
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=394
|
||||
machine.motors.stepsPerRev=200.5
|
||||
machine.pen.size=1
|
||||
controller.page.width=708
|
||||
controller.pixel.mask.color=958341
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=708
|
||||
controller.geomerative.polygonizer=1
|
||||
controller.page.height=730
|
||||
controller.vector.position.y=-198.02
|
||||
controller.background.colour=646464
|
||||
controller.image.filename=
|
||||
controller.vector.position.x=-700.27
|
||||
controller.homepoint.y=150
|
||||
controller.guide.colour=FFFFFF
|
||||
machine.motors.maxSpeed=500
|
||||
controller.homepoint.x=354
|
||||
controller.density.preview.style=3
|
||||
controller.pixel.scaling=3.14
|
||||
controller.densitypreview.colour=000000
|
||||
machine.height=1097
|
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Mon Nov 12 21:22:36 CET 2018
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=177
|
||||
controller.pictureframe.position.x=76
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=969696
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=/home/fredervish/Bureau/Heckert_GNU_white.svg
|
||||
controller.window.width=1383
|
||||
controller.frame.colour=C80000
|
||||
controller.image.position.y=588
|
||||
controller.image.position.x=131
|
||||
machine.motors.accel=253
|
||||
controller.image.height=394
|
||||
controller.machine.serialport=32
|
||||
controller.window.height=148
|
||||
controller.maxSegmentLength=2
|
||||
controller.geomerative.polygonizerLength=1
|
||||
machine.penlift.up=19
|
||||
machine.penlift.down=109
|
||||
controller.page.position.y=120
|
||||
controller.vector.scaling=42.1
|
||||
controller.page.position.x=0
|
||||
controller.pictureframe.width=570
|
||||
machine.step.multiplier=2
|
||||
controller.grid.size=93.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=DCDCDC
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=394
|
||||
machine.motors.stepsPerRev=200.5
|
||||
machine.pen.size=4.05
|
||||
controller.page.width=708
|
||||
controller.pixel.mask.color=958341
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=708
|
||||
controller.geomerative.polygonizer=1
|
||||
controller.page.height=978
|
||||
controller.vector.position.y=-198.02
|
||||
controller.background.colour=646464
|
||||
controller.image.filename=/home/fredervish/Documents/lov-polargraph/2_dessins-imprimer/Common_Kingfisher_Alcedo_atthis.jpg
|
||||
controller.vector.position.x=-700.27
|
||||
controller.homepoint.y=120
|
||||
controller.guide.colour=FFFFFF
|
||||
machine.motors.maxSpeed=499
|
||||
controller.homepoint.x=354
|
||||
controller.density.preview.style=3
|
||||
controller.pixel.scaling=3.14
|
||||
controller.densitypreview.colour=000000
|
||||
machine.height=1097
|
|
@ -0,0 +1,53 @@
|
|||
# *** Polargraph properties file ***
|
||||
#Sun Dec 16 15:32:46 CET 2018
|
||||
controller.pixel.samplearea=10
|
||||
controller.pictureframe.position.y=177
|
||||
controller.pictureframe.position.x=76
|
||||
controller.testPenWidth.startSize=0.5
|
||||
controller.machine.colour=969696
|
||||
machine.motors.mmPerRev=109.5
|
||||
controller.vector.filename=/home/fredervish/Bureau/Heckert_GNU_white.svg
|
||||
controller.window.width=1367
|
||||
controller.frame.colour=C80000
|
||||
controller.image.position.y=588
|
||||
controller.image.position.x=131
|
||||
machine.motors.accel=253
|
||||
controller.image.height=394
|
||||
controller.machine.serialport=32
|
||||
controller.window.height=110
|
||||
controller.maxSegmentLength=2
|
||||
controller.geomerative.polygonizerLength=1
|
||||
machine.penlift.up=52
|
||||
machine.penlift.down=109
|
||||
controller.page.position.y=120
|
||||
controller.vector.scaling=42.1
|
||||
controller.page.position.x=0
|
||||
machine.step.multiplier=2
|
||||
controller.pictureframe.width=570
|
||||
controller.grid.size=93.0
|
||||
controller.testPenWidth.endSize=2
|
||||
controller.pictureframe.height=850
|
||||
controller.page.colour=DCDCDC
|
||||
controller.testPenWidth.incrementSize=0.5
|
||||
controller.image.width=394
|
||||
machine.motors.stepsPerRev=200.5
|
||||
machine.pen.size=4.05
|
||||
controller.page.width=708
|
||||
controller.pixel.mask.color=958341
|
||||
controller.machine.baudrate=57600
|
||||
controller.vector.minLineLength=0
|
||||
machine.width=708
|
||||
controller.geomerative.polygonizer=1
|
||||
controller.page.height=978
|
||||
controller.vector.position.y=-198.02
|
||||
controller.vector.position.x=-700.27
|
||||
controller.image.filename=/home/fredervish/Documents/lov-polargraph/2_dessins-imprimer/Common_Kingfisher_Alcedo_atthis.jpg
|
||||
controller.background.colour=646464
|
||||
controller.homepoint.y=120
|
||||
controller.homepoint.x=354
|
||||
machine.motors.maxSpeed=499
|
||||
controller.guide.colour=FFFFFF
|
||||
controller.density.preview.style=3
|
||||
controller.pixel.scaling=3.14
|
||||
controller.densitypreview.colour=000000
|
||||
machine.height=1097
|
|
@ -0,0 +1,286 @@
|
|||
/**
|
||||
* ControlP5 Accordion
|
||||
* arrange controller groups in an accordion like style.
|
||||
*
|
||||
* find a list of public methods available for the Accordion Controller
|
||||
* at the bottom of this sketch. In the example below 3 groups with controllers
|
||||
* are created and added to an accordion controller. Furthermore several key
|
||||
* combinations are mapped to control individual settings of the accordion.
|
||||
* An accordion comes in 2 modes, Accordion.SINGLE and Accordion.MULTI where the
|
||||
* latter allows to open multiple groups of an accordion and the SINGLE mode only
|
||||
* allows 1 group to be opened at a time.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Accordion accordion;
|
||||
|
||||
color c = color(0, 160, 100);
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
noStroke();
|
||||
smooth();
|
||||
gui();
|
||||
}
|
||||
|
||||
void gui() {
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// group number 1, contains 2 bangs
|
||||
Group g1 = cp5.addGroup("myGroup1")
|
||||
.setBackgroundColor(color(0, 64))
|
||||
.setBackgroundHeight(150)
|
||||
;
|
||||
|
||||
cp5.addBang("bang")
|
||||
.setPosition(10,20)
|
||||
.setSize(100,100)
|
||||
.moveTo(g1)
|
||||
.plugTo(this,"shuffle");
|
||||
;
|
||||
|
||||
// group number 2, contains a radiobutton
|
||||
Group g2 = cp5.addGroup("myGroup2")
|
||||
.setBackgroundColor(color(0, 64))
|
||||
.setBackgroundHeight(150)
|
||||
;
|
||||
|
||||
cp5.addRadioButton("radio")
|
||||
.setPosition(10,20)
|
||||
.setItemWidth(20)
|
||||
.setItemHeight(20)
|
||||
.addItem("black", 0)
|
||||
.addItem("red", 1)
|
||||
.addItem("green", 2)
|
||||
.addItem("blue", 3)
|
||||
.addItem("grey", 4)
|
||||
.setColorLabel(color(255))
|
||||
.activate(2)
|
||||
.moveTo(g2)
|
||||
;
|
||||
|
||||
// group number 3, contains a bang and a slider
|
||||
Group g3 = cp5.addGroup("myGroup3")
|
||||
.setBackgroundColor(color(0, 64))
|
||||
.setBackgroundHeight(150)
|
||||
;
|
||||
|
||||
cp5.addBang("shuffle")
|
||||
.setPosition(10,20)
|
||||
.setSize(40,50)
|
||||
.moveTo(g3)
|
||||
;
|
||||
|
||||
cp5.addSlider("hello")
|
||||
.setPosition(60,20)
|
||||
.setSize(100,20)
|
||||
.setRange(100,500)
|
||||
.setValue(100)
|
||||
.moveTo(g3)
|
||||
;
|
||||
|
||||
cp5.addSlider("world")
|
||||
.setPosition(60,50)
|
||||
.setSize(100,20)
|
||||
.setRange(100,500)
|
||||
.setValue(200)
|
||||
.moveTo(g3)
|
||||
;
|
||||
|
||||
// create a new accordion
|
||||
// add g1, g2, and g3 to the accordion.
|
||||
accordion = cp5.addAccordion("acc")
|
||||
.setPosition(40,40)
|
||||
.setWidth(200)
|
||||
.addItem(g1)
|
||||
.addItem(g2)
|
||||
.addItem(g3)
|
||||
;
|
||||
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.open(0,1,2);}}, 'o');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.close(0,1,2);}}, 'c');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setWidth(300);}}, '1');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setPosition(0,0);accordion.setItemHeight(190);}}, '2');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.ALL);}}, '3');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {accordion.setCollapseMode(ControlP5.SINGLE);}}, '4');
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {cp5.remove("myGroup1");}}, '0');
|
||||
|
||||
accordion.open(0,1,2);
|
||||
|
||||
// use Accordion.MULTI to allow multiple group
|
||||
// to be open at a time.
|
||||
accordion.setCollapseMode(Accordion.MULTI);
|
||||
|
||||
// when in SINGLE mode, only 1 accordion
|
||||
// group can be open at a time.
|
||||
// accordion.setCollapseMode(Accordion.SINGLE);
|
||||
}
|
||||
|
||||
|
||||
void radio(int theC) {
|
||||
switch(theC) {
|
||||
case(0):c=color(0,200);break;
|
||||
case(1):c=color(255,0,0,200);break;
|
||||
case(2):c=color(0, 200, 140,200);break;
|
||||
case(3):c=color(0, 128, 255,200);break;
|
||||
case(4):c=color(50,128);break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void shuffle() {
|
||||
c = color(random(255),random(255),random(255),random(128,255));
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(220);
|
||||
|
||||
fill(c);
|
||||
|
||||
float s1 = cp5.getController("hello").getValue();
|
||||
ellipse(200,400,s1,s1);
|
||||
|
||||
float s2 = cp5.getController("world").getValue();
|
||||
ellipse(300,100,s2,s2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Accordion Controller
|
||||
use ControlP5.printPublicMethodsFor(Accordion.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Accordion in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Accordion : Accordion addItem(ControlGroup)
|
||||
controlP5.Accordion : Accordion close()
|
||||
controlP5.Accordion : Accordion open()
|
||||
controlP5.Accordion : Accordion remove(ControllerInterface)
|
||||
controlP5.Accordion : Accordion removeItem(ControlGroup)
|
||||
controlP5.Accordion : Accordion setCollapseMode(int)
|
||||
controlP5.Accordion : Accordion setItemHeight(int)
|
||||
controlP5.Accordion : Accordion setMinItemHeight(int)
|
||||
controlP5.Accordion : Accordion setWidth(int)
|
||||
controlP5.Accordion : Accordion updateItems()
|
||||
controlP5.Accordion : int getItemHeight()
|
||||
controlP5.Accordion : int getMinItemHeight()
|
||||
controlP5.ControlGroup : Accordion activateEvent(boolean)
|
||||
controlP5.ControlGroup : Accordion addListener(ControlListener)
|
||||
controlP5.ControlGroup : Accordion removeListener(ControlListener)
|
||||
controlP5.ControlGroup : Accordion setBackgroundColor(int)
|
||||
controlP5.ControlGroup : Accordion setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : Accordion setBarHeight(int)
|
||||
controlP5.ControlGroup : Accordion setSize(int, int)
|
||||
controlP5.ControlGroup : Accordion updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : Accordion add(ControllerInterface)
|
||||
controlP5.ControllerGroup : Accordion addListener(ControlListener)
|
||||
controlP5.ControllerGroup : Accordion bringToFront()
|
||||
controlP5.ControllerGroup : Accordion bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : Accordion close()
|
||||
controlP5.ControllerGroup : Accordion disableCollapse()
|
||||
controlP5.ControllerGroup : Accordion enableCollapse()
|
||||
controlP5.ControllerGroup : Accordion hide()
|
||||
controlP5.ControllerGroup : Accordion hideArrow()
|
||||
controlP5.ControllerGroup : Accordion hideBar()
|
||||
controlP5.ControllerGroup : Accordion moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : Accordion moveTo(PApplet)
|
||||
controlP5.ControllerGroup : Accordion open()
|
||||
controlP5.ControllerGroup : Accordion registerProperty(String)
|
||||
controlP5.ControllerGroup : Accordion registerProperty(String, String)
|
||||
controlP5.ControllerGroup : Accordion remove(CDrawable)
|
||||
controlP5.ControllerGroup : Accordion remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : Accordion removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : Accordion removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : Accordion removeProperty(String)
|
||||
controlP5.ControllerGroup : Accordion removeProperty(String, String)
|
||||
controlP5.ControllerGroup : Accordion setAddress(String)
|
||||
controlP5.ControllerGroup : Accordion setArrayValue(float[])
|
||||
controlP5.ControllerGroup : Accordion setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : Accordion setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : Accordion setColor(CColor)
|
||||
controlP5.ControllerGroup : Accordion setColorActive(int)
|
||||
controlP5.ControllerGroup : Accordion setColorBackground(int)
|
||||
controlP5.ControllerGroup : Accordion setColorForeground(int)
|
||||
controlP5.ControllerGroup : Accordion setColorLabel(int)
|
||||
controlP5.ControllerGroup : Accordion setColorValue(int)
|
||||
controlP5.ControllerGroup : Accordion setHeight(int)
|
||||
controlP5.ControllerGroup : Accordion setId(int)
|
||||
controlP5.ControllerGroup : Accordion setLabel(String)
|
||||
controlP5.ControllerGroup : Accordion setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : Accordion setMoveable(boolean)
|
||||
controlP5.ControllerGroup : Accordion setOpen(boolean)
|
||||
controlP5.ControllerGroup : Accordion setPosition(float, float)
|
||||
controlP5.ControllerGroup : Accordion setPosition(float[])
|
||||
controlP5.ControllerGroup : Accordion setSize(int, int)
|
||||
controlP5.ControllerGroup : Accordion setStringValue(String)
|
||||
controlP5.ControllerGroup : Accordion setTitle(String)
|
||||
controlP5.ControllerGroup : Accordion setUpdate(boolean)
|
||||
controlP5.ControllerGroup : Accordion setValue(float)
|
||||
controlP5.ControllerGroup : Accordion setVisible(boolean)
|
||||
controlP5.ControllerGroup : Accordion setWidth(int)
|
||||
controlP5.ControllerGroup : Accordion show()
|
||||
controlP5.ControllerGroup : Accordion showArrow()
|
||||
controlP5.ControllerGroup : Accordion showBar()
|
||||
controlP5.ControllerGroup : Accordion update()
|
||||
controlP5.ControllerGroup : Accordion updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:32
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
* ControlP5 Background
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Group Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2014
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
int v1;
|
||||
boolean lines = true;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.begin(cp5.addBackground("abc"));
|
||||
|
||||
cp5.addSlider("v1")
|
||||
.setPosition(10, 20)
|
||||
.setSize(200, 20)
|
||||
.setRange(100, 300)
|
||||
.setValue(250)
|
||||
;
|
||||
|
||||
cp5.addToggle("lines")
|
||||
.setPosition(10,50)
|
||||
.setSize(80,20)
|
||||
.setMode(Toggle.SWITCH)
|
||||
;
|
||||
|
||||
cp5.end();
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(200, 200, 200);
|
||||
|
||||
pushMatrix();
|
||||
|
||||
pushMatrix();
|
||||
fill(255, 255, 0);
|
||||
rect(v1, 100, 60, 200);
|
||||
fill(0, 255, 110);
|
||||
rect(40, v1, 320, 40);
|
||||
translate(200, 200);
|
||||
rotate(map(v1, 100, 300, -PI, PI));
|
||||
fill(255, 0, 128);
|
||||
rect(0, 0, 100, 100);
|
||||
popMatrix();
|
||||
|
||||
if(lines) {
|
||||
translate(600, 100);
|
||||
for (int i=0; i<20; i++) {
|
||||
pushMatrix();
|
||||
fill(255);
|
||||
translate(0, i*10);
|
||||
rotate(map(v1+i, 0, 300, -PI, PI));
|
||||
rect(-150, 0, 300, 4);
|
||||
popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the Background Controller
|
||||
use ControlP5.printPublicMethodsFor(Background.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Background in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlGroup : Background activateEvent(boolean)
|
||||
controlP5.ControlGroup : Background addListener(ControlListener)
|
||||
controlP5.ControlGroup : Background removeListener(ControlListener)
|
||||
controlP5.ControlGroup : Background setBackgroundColor(int)
|
||||
controlP5.ControlGroup : Background setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : Background setBarHeight(int)
|
||||
controlP5.ControlGroup : Background setSize(int, int)
|
||||
controlP5.ControlGroup : Background updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : Background add(ControllerInterface)
|
||||
controlP5.ControllerGroup : Background addListener(ControlListener)
|
||||
controlP5.ControllerGroup : Background bringToFront()
|
||||
controlP5.ControllerGroup : Background bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : Background close()
|
||||
controlP5.ControllerGroup : Background disableCollapse()
|
||||
controlP5.ControllerGroup : Background enableCollapse()
|
||||
controlP5.ControllerGroup : Background hide()
|
||||
controlP5.ControllerGroup : Background hideArrow()
|
||||
controlP5.ControllerGroup : Background hideBar()
|
||||
controlP5.ControllerGroup : Background moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : Background moveTo(PApplet)
|
||||
controlP5.ControllerGroup : Background open()
|
||||
controlP5.ControllerGroup : Background registerProperty(String)
|
||||
controlP5.ControllerGroup : Background registerProperty(String, String)
|
||||
controlP5.ControllerGroup : Background remove(CDrawable)
|
||||
controlP5.ControllerGroup : Background remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : Background removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : Background removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : Background removeProperty(String)
|
||||
controlP5.ControllerGroup : Background removeProperty(String, String)
|
||||
controlP5.ControllerGroup : Background setAddress(String)
|
||||
controlP5.ControllerGroup : Background setArrayValue(float[])
|
||||
controlP5.ControllerGroup : Background setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : Background setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : Background setColor(CColor)
|
||||
controlP5.ControllerGroup : Background setColorActive(int)
|
||||
controlP5.ControllerGroup : Background setColorBackground(int)
|
||||
controlP5.ControllerGroup : Background setColorForeground(int)
|
||||
controlP5.ControllerGroup : Background setColorLabel(int)
|
||||
controlP5.ControllerGroup : Background setColorValue(int)
|
||||
controlP5.ControllerGroup : Background setHeight(int)
|
||||
controlP5.ControllerGroup : Background setId(int)
|
||||
controlP5.ControllerGroup : Background setLabel(String)
|
||||
controlP5.ControllerGroup : Background setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : Background setMoveable(boolean)
|
||||
controlP5.ControllerGroup : Background setOpen(boolean)
|
||||
controlP5.ControllerGroup : Background setPosition(float, float)
|
||||
controlP5.ControllerGroup : Background setPosition(float[])
|
||||
controlP5.ControllerGroup : Background setSize(int, int)
|
||||
controlP5.ControllerGroup : Background setStringValue(String)
|
||||
controlP5.ControllerGroup : Background setTitle(String)
|
||||
controlP5.ControllerGroup : Background setUpdate(boolean)
|
||||
controlP5.ControllerGroup : Background setValue(float)
|
||||
controlP5.ControllerGroup : Background setVisible(boolean)
|
||||
controlP5.ControllerGroup : Background setWidth(int)
|
||||
controlP5.ControllerGroup : Background show()
|
||||
controlP5.ControllerGroup : Background showArrow()
|
||||
controlP5.ControllerGroup : Background showBar()
|
||||
controlP5.ControllerGroup : Background update()
|
||||
controlP5.ControllerGroup : Background updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:35
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
mode.id=processing.mode.java.JavaMode
|
||||
mode=Java
|
|
@ -0,0 +1,231 @@
|
|||
/**
|
||||
* ControlP5 Bang
|
||||
* A bang triggers an event that can be received by a function named after the bang.
|
||||
* By default a bang is triggered when pressed, this can be changed to 'release'
|
||||
* using theBang.setTriggerEvent(Bang.RELEASE).
|
||||
*
|
||||
* find a list of public methods available for the Bang Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0, 0, 0);
|
||||
|
||||
color[] col = new color[] {
|
||||
color(100), color(150), color(200), color(250)
|
||||
};
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
for (int i=0;i<col.length;i++) {
|
||||
cp5.addBang("bang"+i)
|
||||
.setPosition(40+i*80, 200)
|
||||
.setSize(40, 40)
|
||||
.setId(i)
|
||||
;
|
||||
}
|
||||
|
||||
// change the trigger event, by default it is PRESSED.
|
||||
cp5.addBang("bang")
|
||||
.setPosition(40, 300)
|
||||
.setSize(280, 40)
|
||||
.setTriggerEvent(Bang.RELEASE)
|
||||
.setLabel("changeBackground")
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
for (int i=0;i<col.length;i++) {
|
||||
fill(col[i]);
|
||||
rect(40+i*80, 50, 40, 80);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void bang() {
|
||||
int theColor = (int)random(255);
|
||||
myColorBackground = color(theColor);
|
||||
println("### bang(). a bang event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
for (int i=0;i<col.length;i++) {
|
||||
if (theEvent.getController().getName().equals("bang"+i)) {
|
||||
col[i] = color(random(255));
|
||||
}
|
||||
}
|
||||
|
||||
println(
|
||||
"## controlEvent / id:"+theEvent.controller().getId()+
|
||||
" / name:"+theEvent.controller().getName()+
|
||||
" / value:"+theEvent.controller().getValue()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Bang Controller
|
||||
use ControlP5.printPublicMethodsFor(Bang.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Bang in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Bang : Bang setTriggerEvent(int)
|
||||
controlP5.Bang : Bang setValue(float)
|
||||
controlP5.Bang : Bang update()
|
||||
controlP5.Bang : String getInfo()
|
||||
controlP5.Bang : String toString()
|
||||
controlP5.Bang : int getTriggerEvent()
|
||||
controlP5.Controller : Bang addCallback(CallbackListener)
|
||||
controlP5.Controller : Bang addListener(ControlListener)
|
||||
controlP5.Controller : Bang addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Bang align(int, int, int, int)
|
||||
controlP5.Controller : Bang bringToFront()
|
||||
controlP5.Controller : Bang bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Bang hide()
|
||||
controlP5.Controller : Bang linebreak()
|
||||
controlP5.Controller : Bang listen(boolean)
|
||||
controlP5.Controller : Bang lock()
|
||||
controlP5.Controller : Bang onChange(CallbackListener)
|
||||
controlP5.Controller : Bang onClick(CallbackListener)
|
||||
controlP5.Controller : Bang onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Bang onDrag(CallbackListener)
|
||||
controlP5.Controller : Bang onDraw(ControllerView)
|
||||
controlP5.Controller : Bang onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Bang onEnter(CallbackListener)
|
||||
controlP5.Controller : Bang onLeave(CallbackListener)
|
||||
controlP5.Controller : Bang onMove(CallbackListener)
|
||||
controlP5.Controller : Bang onPress(CallbackListener)
|
||||
controlP5.Controller : Bang onRelease(CallbackListener)
|
||||
controlP5.Controller : Bang onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Bang onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Bang onWheel(CallbackListener)
|
||||
controlP5.Controller : Bang plugTo(Object)
|
||||
controlP5.Controller : Bang plugTo(Object, String)
|
||||
controlP5.Controller : Bang plugTo(Object[])
|
||||
controlP5.Controller : Bang plugTo(Object[], String)
|
||||
controlP5.Controller : Bang registerProperty(String)
|
||||
controlP5.Controller : Bang registerProperty(String, String)
|
||||
controlP5.Controller : Bang registerTooltip(String)
|
||||
controlP5.Controller : Bang removeBehavior()
|
||||
controlP5.Controller : Bang removeCallback()
|
||||
controlP5.Controller : Bang removeCallback(CallbackListener)
|
||||
controlP5.Controller : Bang removeListener(ControlListener)
|
||||
controlP5.Controller : Bang removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Bang removeListenersFor(int)
|
||||
controlP5.Controller : Bang removeProperty(String)
|
||||
controlP5.Controller : Bang removeProperty(String, String)
|
||||
controlP5.Controller : Bang setArrayValue(float[])
|
||||
controlP5.Controller : Bang setArrayValue(int, float)
|
||||
controlP5.Controller : Bang setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Bang setBroadcast(boolean)
|
||||
controlP5.Controller : Bang setCaptionLabel(String)
|
||||
controlP5.Controller : Bang setColor(CColor)
|
||||
controlP5.Controller : Bang setColorActive(int)
|
||||
controlP5.Controller : Bang setColorBackground(int)
|
||||
controlP5.Controller : Bang setColorCaptionLabel(int)
|
||||
controlP5.Controller : Bang setColorForeground(int)
|
||||
controlP5.Controller : Bang setColorLabel(int)
|
||||
controlP5.Controller : Bang setColorValue(int)
|
||||
controlP5.Controller : Bang setColorValueLabel(int)
|
||||
controlP5.Controller : Bang setDecimalPrecision(int)
|
||||
controlP5.Controller : Bang setDefaultValue(float)
|
||||
controlP5.Controller : Bang setHeight(int)
|
||||
controlP5.Controller : Bang setId(int)
|
||||
controlP5.Controller : Bang setImage(PImage)
|
||||
controlP5.Controller : Bang setImage(PImage, int)
|
||||
controlP5.Controller : Bang setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Bang setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Bang setLabel(String)
|
||||
controlP5.Controller : Bang setLabelVisible(boolean)
|
||||
controlP5.Controller : Bang setLock(boolean)
|
||||
controlP5.Controller : Bang setMax(float)
|
||||
controlP5.Controller : Bang setMin(float)
|
||||
controlP5.Controller : Bang setMouseOver(boolean)
|
||||
controlP5.Controller : Bang setMoveable(boolean)
|
||||
controlP5.Controller : Bang setPosition(float, float)
|
||||
controlP5.Controller : Bang setPosition(float[])
|
||||
controlP5.Controller : Bang setSize(PImage)
|
||||
controlP5.Controller : Bang setSize(int, int)
|
||||
controlP5.Controller : Bang setStringValue(String)
|
||||
controlP5.Controller : Bang setUpdate(boolean)
|
||||
controlP5.Controller : Bang setValue(float)
|
||||
controlP5.Controller : Bang setValueLabel(String)
|
||||
controlP5.Controller : Bang setValueSelf(float)
|
||||
controlP5.Controller : Bang setView(ControllerView)
|
||||
controlP5.Controller : Bang setVisible(boolean)
|
||||
controlP5.Controller : Bang setWidth(int)
|
||||
controlP5.Controller : Bang show()
|
||||
controlP5.Controller : Bang unlock()
|
||||
controlP5.Controller : Bang unplugFrom(Object)
|
||||
controlP5.Controller : Bang unplugFrom(Object[])
|
||||
controlP5.Controller : Bang unregisterTooltip()
|
||||
controlP5.Controller : Bang update()
|
||||
controlP5.Controller : Bang updateSize()
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:36
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
/**
|
||||
* ControlP5 Button
|
||||
* this example shows how to create buttons with controlP5.
|
||||
*
|
||||
* find a list of public methods available for the Button Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColor = color(255);
|
||||
|
||||
int c1,c2;
|
||||
|
||||
float n,n1;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400,600);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// create a new button with name 'buttonA'
|
||||
cp5.addButton("colorA")
|
||||
.setValue(0)
|
||||
.setPosition(100,100)
|
||||
.setSize(200,19)
|
||||
;
|
||||
|
||||
// and add another 2 buttons
|
||||
cp5.addButton("colorB")
|
||||
.setValue(100)
|
||||
.setPosition(100,120)
|
||||
.setSize(200,19)
|
||||
;
|
||||
|
||||
cp5.addButton("colorC")
|
||||
.setPosition(100,140)
|
||||
.setSize(200,19)
|
||||
.setValue(0)
|
||||
;
|
||||
|
||||
PImage[] imgs = {loadImage("button_a.png"),loadImage("button_b.png"),loadImage("button_c.png")};
|
||||
cp5.addButton("play")
|
||||
.setValue(128)
|
||||
.setPosition(140,300)
|
||||
.setImages(imgs)
|
||||
.updateSize()
|
||||
;
|
||||
|
||||
cp5.addButton("playAgain")
|
||||
.setValue(128)
|
||||
.setPosition(210,300)
|
||||
.setImages(imgs)
|
||||
.updateSize()
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColor);
|
||||
myColor = lerpColor(c1,c2,n);
|
||||
n += (1-n)* 0.1;
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println(theEvent.getController().getName());
|
||||
n = 0;
|
||||
}
|
||||
|
||||
// function colorA will receive changes from
|
||||
// controller with name colorA
|
||||
public void colorA(int theValue) {
|
||||
println("a button event from colorA: "+theValue);
|
||||
c1 = c2;
|
||||
c2 = color(0,160,100);
|
||||
}
|
||||
|
||||
// function colorB will receive changes from
|
||||
// controller with name colorB
|
||||
public void colorB(int theValue) {
|
||||
println("a button event from colorB: "+theValue);
|
||||
c1 = c2;
|
||||
c2 = color(150,0,0);
|
||||
}
|
||||
|
||||
// function colorC will receive changes from
|
||||
// controller with name colorC
|
||||
public void colorC(int theValue) {
|
||||
println("a button event from colorC: "+theValue);
|
||||
c1 = c2;
|
||||
c2 = color(255,255,0);
|
||||
}
|
||||
|
||||
public void play(int theValue) {
|
||||
println("a button event from buttonB: "+theValue);
|
||||
c1 = c2;
|
||||
c2 = color(0,0,0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Button Controller
|
||||
use ControlP5.printPublicMethodsFor(Button.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Button in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Button : Button activateBy(int)
|
||||
controlP5.Button : Button setOff()
|
||||
controlP5.Button : Button setOn()
|
||||
controlP5.Button : Button setSwitch(boolean)
|
||||
controlP5.Button : Button setValue(float)
|
||||
controlP5.Button : Button update()
|
||||
controlP5.Button : String getInfo()
|
||||
controlP5.Button : String toString()
|
||||
controlP5.Button : boolean getBooleanValue()
|
||||
controlP5.Button : boolean isOn()
|
||||
controlP5.Button : boolean isPressed()
|
||||
controlP5.Button : boolean isSwitch()
|
||||
controlP5.Controller : Button addCallback(CallbackListener)
|
||||
controlP5.Controller : Button addListener(ControlListener)
|
||||
controlP5.Controller : Button addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Button align(int, int, int, int)
|
||||
controlP5.Controller : Button bringToFront()
|
||||
controlP5.Controller : Button bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Button hide()
|
||||
controlP5.Controller : Button linebreak()
|
||||
controlP5.Controller : Button listen(boolean)
|
||||
controlP5.Controller : Button lock()
|
||||
controlP5.Controller : Button onChange(CallbackListener)
|
||||
controlP5.Controller : Button onClick(CallbackListener)
|
||||
controlP5.Controller : Button onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Button onDrag(CallbackListener)
|
||||
controlP5.Controller : Button onDraw(ControllerView)
|
||||
controlP5.Controller : Button onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Button onEnter(CallbackListener)
|
||||
controlP5.Controller : Button onLeave(CallbackListener)
|
||||
controlP5.Controller : Button onMove(CallbackListener)
|
||||
controlP5.Controller : Button onPress(CallbackListener)
|
||||
controlP5.Controller : Button onRelease(CallbackListener)
|
||||
controlP5.Controller : Button onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Button onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Button onWheel(CallbackListener)
|
||||
controlP5.Controller : Button plugTo(Object)
|
||||
controlP5.Controller : Button plugTo(Object, String)
|
||||
controlP5.Controller : Button plugTo(Object[])
|
||||
controlP5.Controller : Button plugTo(Object[], String)
|
||||
controlP5.Controller : Button registerProperty(String)
|
||||
controlP5.Controller : Button registerProperty(String, String)
|
||||
controlP5.Controller : Button registerTooltip(String)
|
||||
controlP5.Controller : Button removeBehavior()
|
||||
controlP5.Controller : Button removeCallback()
|
||||
controlP5.Controller : Button removeCallback(CallbackListener)
|
||||
controlP5.Controller : Button removeListener(ControlListener)
|
||||
controlP5.Controller : Button removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Button removeListenersFor(int)
|
||||
controlP5.Controller : Button removeProperty(String)
|
||||
controlP5.Controller : Button removeProperty(String, String)
|
||||
controlP5.Controller : Button setArrayValue(float[])
|
||||
controlP5.Controller : Button setArrayValue(int, float)
|
||||
controlP5.Controller : Button setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Button setBroadcast(boolean)
|
||||
controlP5.Controller : Button setCaptionLabel(String)
|
||||
controlP5.Controller : Button setColor(CColor)
|
||||
controlP5.Controller : Button setColorActive(int)
|
||||
controlP5.Controller : Button setColorBackground(int)
|
||||
controlP5.Controller : Button setColorCaptionLabel(int)
|
||||
controlP5.Controller : Button setColorForeground(int)
|
||||
controlP5.Controller : Button setColorLabel(int)
|
||||
controlP5.Controller : Button setColorValue(int)
|
||||
controlP5.Controller : Button setColorValueLabel(int)
|
||||
controlP5.Controller : Button setDecimalPrecision(int)
|
||||
controlP5.Controller : Button setDefaultValue(float)
|
||||
controlP5.Controller : Button setHeight(int)
|
||||
controlP5.Controller : Button setId(int)
|
||||
controlP5.Controller : Button setImage(PImage)
|
||||
controlP5.Controller : Button setImage(PImage, int)
|
||||
controlP5.Controller : Button setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Button setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Button setLabel(String)
|
||||
controlP5.Controller : Button setLabelVisible(boolean)
|
||||
controlP5.Controller : Button setLock(boolean)
|
||||
controlP5.Controller : Button setMax(float)
|
||||
controlP5.Controller : Button setMin(float)
|
||||
controlP5.Controller : Button setMouseOver(boolean)
|
||||
controlP5.Controller : Button setMoveable(boolean)
|
||||
controlP5.Controller : Button setPosition(float, float)
|
||||
controlP5.Controller : Button setPosition(float[])
|
||||
controlP5.Controller : Button setSize(PImage)
|
||||
controlP5.Controller : Button setSize(int, int)
|
||||
controlP5.Controller : Button setStringValue(String)
|
||||
controlP5.Controller : Button setUpdate(boolean)
|
||||
controlP5.Controller : Button setValue(float)
|
||||
controlP5.Controller : Button setValueLabel(String)
|
||||
controlP5.Controller : Button setValueSelf(float)
|
||||
controlP5.Controller : Button setView(ControllerView)
|
||||
controlP5.Controller : Button setVisible(boolean)
|
||||
controlP5.Controller : Button setWidth(int)
|
||||
controlP5.Controller : Button show()
|
||||
controlP5.Controller : Button unlock()
|
||||
controlP5.Controller : Button unplugFrom(Object)
|
||||
controlP5.Controller : Button unplugFrom(Object[])
|
||||
controlP5.Controller : Button unregisterTooltip()
|
||||
controlP5.Controller : Button update()
|
||||
controlP5.Controller : Button updateSize()
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:49
|
||||
|
||||
*/
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,207 @@
|
|||
/**
|
||||
* ControlP5 ButtonBar
|
||||
*
|
||||
* work-in-progress
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
ButtonBar b = cp5.addButtonBar("bar")
|
||||
.setPosition(0, 0)
|
||||
.setSize(400, 20)
|
||||
.addItems(split("a b c d e f g h i j"," "))
|
||||
;
|
||||
println(b.getItem("a"));
|
||||
b.changeItem("a","text","first");
|
||||
b.changeItem("b","text","second");
|
||||
b.changeItem("c","text","third");
|
||||
b.onMove(new CallbackListener(){
|
||||
public void controlEvent(CallbackEvent ev) {
|
||||
ButtonBar bar = (ButtonBar)ev.getController();
|
||||
println("hello ",bar.hover());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void bar(int n) {
|
||||
println("bar clicked, item-value:", n);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(220);
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the ButtonBar Controller
|
||||
use ControlP5.printPublicMethodsFor(ButtonBar.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ButtonBar in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ButtonBar : ButtonBar addItem(String, Object)
|
||||
controlP5.ButtonBar : ButtonBar addItems(List)
|
||||
controlP5.ButtonBar : ButtonBar addItems(Map)
|
||||
controlP5.ButtonBar : ButtonBar addItems(String[])
|
||||
controlP5.ButtonBar : ButtonBar clear()
|
||||
controlP5.ButtonBar : ButtonBar removeItem(String)
|
||||
controlP5.ButtonBar : ButtonBar removeItems(List)
|
||||
controlP5.ButtonBar : ButtonBar setItems(List)
|
||||
controlP5.ButtonBar : ButtonBar setItems(Map)
|
||||
controlP5.ButtonBar : ButtonBar setItems(String[])
|
||||
controlP5.ButtonBar : List getItems()
|
||||
controlP5.ButtonBar : Map getItem(String)
|
||||
controlP5.ButtonBar : int hover()
|
||||
controlP5.ButtonBar : void changeItem(String, String, Object)
|
||||
controlP5.ButtonBar : void onClick()
|
||||
controlP5.Controller : ButtonBar addCallback(CallbackListener)
|
||||
controlP5.Controller : ButtonBar addListener(ControlListener)
|
||||
controlP5.Controller : ButtonBar addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ButtonBar align(int, int, int, int)
|
||||
controlP5.Controller : ButtonBar bringToFront()
|
||||
controlP5.Controller : ButtonBar bringToFront(ControllerInterface)
|
||||
controlP5.Controller : ButtonBar hide()
|
||||
controlP5.Controller : ButtonBar linebreak()
|
||||
controlP5.Controller : ButtonBar listen(boolean)
|
||||
controlP5.Controller : ButtonBar lock()
|
||||
controlP5.Controller : ButtonBar onChange(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onClick(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onDoublePress(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onDrag(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onDraw(ControllerView)
|
||||
controlP5.Controller : ButtonBar onEndDrag(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onEnter(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onLeave(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onMove(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onPress(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onRelease(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onStartDrag(CallbackListener)
|
||||
controlP5.Controller : ButtonBar onWheel(CallbackListener)
|
||||
controlP5.Controller : ButtonBar plugTo(Object)
|
||||
controlP5.Controller : ButtonBar plugTo(Object, String)
|
||||
controlP5.Controller : ButtonBar plugTo(Object[])
|
||||
controlP5.Controller : ButtonBar plugTo(Object[], String)
|
||||
controlP5.Controller : ButtonBar registerProperty(String)
|
||||
controlP5.Controller : ButtonBar registerProperty(String, String)
|
||||
controlP5.Controller : ButtonBar registerTooltip(String)
|
||||
controlP5.Controller : ButtonBar removeBehavior()
|
||||
controlP5.Controller : ButtonBar removeCallback()
|
||||
controlP5.Controller : ButtonBar removeCallback(CallbackListener)
|
||||
controlP5.Controller : ButtonBar removeListener(ControlListener)
|
||||
controlP5.Controller : ButtonBar removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ButtonBar removeListenersFor(int)
|
||||
controlP5.Controller : ButtonBar removeProperty(String)
|
||||
controlP5.Controller : ButtonBar removeProperty(String, String)
|
||||
controlP5.Controller : ButtonBar setArrayValue(float[])
|
||||
controlP5.Controller : ButtonBar setArrayValue(int, float)
|
||||
controlP5.Controller : ButtonBar setBehavior(ControlBehavior)
|
||||
controlP5.Controller : ButtonBar setBroadcast(boolean)
|
||||
controlP5.Controller : ButtonBar setCaptionLabel(String)
|
||||
controlP5.Controller : ButtonBar setColor(CColor)
|
||||
controlP5.Controller : ButtonBar setColorActive(int)
|
||||
controlP5.Controller : ButtonBar setColorBackground(int)
|
||||
controlP5.Controller : ButtonBar setColorCaptionLabel(int)
|
||||
controlP5.Controller : ButtonBar setColorForeground(int)
|
||||
controlP5.Controller : ButtonBar setColorLabel(int)
|
||||
controlP5.Controller : ButtonBar setColorValue(int)
|
||||
controlP5.Controller : ButtonBar setColorValueLabel(int)
|
||||
controlP5.Controller : ButtonBar setDecimalPrecision(int)
|
||||
controlP5.Controller : ButtonBar setDefaultValue(float)
|
||||
controlP5.Controller : ButtonBar setHeight(int)
|
||||
controlP5.Controller : ButtonBar setId(int)
|
||||
controlP5.Controller : ButtonBar setImage(PImage)
|
||||
controlP5.Controller : ButtonBar setImage(PImage, int)
|
||||
controlP5.Controller : ButtonBar setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : ButtonBar setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : ButtonBar setLabel(String)
|
||||
controlP5.Controller : ButtonBar setLabelVisible(boolean)
|
||||
controlP5.Controller : ButtonBar setLock(boolean)
|
||||
controlP5.Controller : ButtonBar setMax(float)
|
||||
controlP5.Controller : ButtonBar setMin(float)
|
||||
controlP5.Controller : ButtonBar setMouseOver(boolean)
|
||||
controlP5.Controller : ButtonBar setMoveable(boolean)
|
||||
controlP5.Controller : ButtonBar setPosition(float, float)
|
||||
controlP5.Controller : ButtonBar setPosition(float[])
|
||||
controlP5.Controller : ButtonBar setSize(PImage)
|
||||
controlP5.Controller : ButtonBar setSize(int, int)
|
||||
controlP5.Controller : ButtonBar setStringValue(String)
|
||||
controlP5.Controller : ButtonBar setUpdate(boolean)
|
||||
controlP5.Controller : ButtonBar setValue(float)
|
||||
controlP5.Controller : ButtonBar setValueLabel(String)
|
||||
controlP5.Controller : ButtonBar setValueSelf(float)
|
||||
controlP5.Controller : ButtonBar setView(ControllerView)
|
||||
controlP5.Controller : ButtonBar setVisible(boolean)
|
||||
controlP5.Controller : ButtonBar setWidth(int)
|
||||
controlP5.Controller : ButtonBar show()
|
||||
controlP5.Controller : ButtonBar unlock()
|
||||
controlP5.Controller : ButtonBar unplugFrom(Object)
|
||||
controlP5.Controller : ButtonBar unplugFrom(Object[])
|
||||
controlP5.Controller : ButtonBar unregisterTooltip()
|
||||
controlP5.Controller : ButtonBar update()
|
||||
controlP5.Controller : ButtonBar updateSize()
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:51
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
/**
|
||||
* ControlP5 Canvas
|
||||
* The ControlWindowCanvas allow you to add custom graphics to
|
||||
* the default controlP5 renderer or a controlWindow rednerer.
|
||||
*
|
||||
* find a list of public methods available for the Canvas Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
ControlWindow controlWindow;
|
||||
|
||||
Canvas cc;
|
||||
|
||||
// MyCanvas, your Canvas render class
|
||||
class MyCanvas extends Canvas {
|
||||
|
||||
int y;
|
||||
int mx = 0;
|
||||
int my = 0;
|
||||
public void setup(PGraphics pg) {
|
||||
y = 200;
|
||||
}
|
||||
|
||||
public void update(PApplet p) {
|
||||
mx = p.mouseX;
|
||||
my = p.mouseY;
|
||||
}
|
||||
|
||||
public void draw(PGraphics pg) {
|
||||
// renders a square with randomly changing colors
|
||||
// make changes here.
|
||||
pg.fill(100);
|
||||
pg.rect(mx-20, y-20, 240, 30);
|
||||
pg.fill(255);
|
||||
pg.text("This text is drawn by MyCanvas", mx,y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
frameRate(30);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// create a control window canvas and add it to
|
||||
// the previously created control window.
|
||||
cc = new MyCanvas();
|
||||
cc.pre(); // use cc.post(); to draw on top of existing controllers.
|
||||
cp5.addCanvas(cc); // add the canvas to cp5
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
fill(60);
|
||||
rect(100, 100, 200, 200);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Canvas Controller
|
||||
use ControlP5.printPublicMethodsFor(Canvas.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Canvas in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Canvas : void moveTo(ControlWindow)
|
||||
controlP5.Canvas : void setup(PGraphics)
|
||||
controlP5.Canvas : void update(PApplet)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:53
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,243 @@
|
|||
/**
|
||||
* ControlP5 Chart
|
||||
*
|
||||
* find a list of public methods available for the Chart Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2014
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Chart myChart;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
myChart = cp5.addChart("dataflow")
|
||||
.setPosition(50, 50)
|
||||
.setSize(200, 100)
|
||||
.setRange(-20, 20)
|
||||
.setView(Chart.LINE) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
|
||||
.setStrokeWeight(1.5)
|
||||
.setColorCaptionLabel(color(40))
|
||||
;
|
||||
|
||||
myChart.addDataSet("incoming");
|
||||
myChart.setData("incoming", new float[100]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(200);
|
||||
// unshift: add data from left to right (first in)
|
||||
//myChart.unshift("incoming", (sin(frameCount*0.1)*20));
|
||||
|
||||
// push: add data from right to left (last in)
|
||||
myChart.push("incoming", (sin(frameCount*0.1)*10));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Chart Controller
|
||||
use ControlP5.printPublicMethodsFor(Chart.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Chart in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Chart : Chart addData(ChartData)
|
||||
controlP5.Chart : Chart addData(ChartDataSet, float)
|
||||
controlP5.Chart : Chart addData(String, ChartData)
|
||||
controlP5.Chart : Chart addData(String, float)
|
||||
controlP5.Chart : Chart addData(float)
|
||||
controlP5.Chart : Chart addDataSet(String)
|
||||
controlP5.Chart : Chart addFirst(String, float)
|
||||
controlP5.Chart : Chart addFirst(float)
|
||||
controlP5.Chart : Chart addLast(String, float)
|
||||
controlP5.Chart : Chart addLast(float)
|
||||
controlP5.Chart : Chart push(String, float)
|
||||
controlP5.Chart : Chart push(float)
|
||||
controlP5.Chart : Chart removeData(ChartData)
|
||||
controlP5.Chart : Chart removeData(String, ChartData)
|
||||
controlP5.Chart : Chart removeData(String, int)
|
||||
controlP5.Chart : Chart removeData(int)
|
||||
controlP5.Chart : Chart removeDataSet(String)
|
||||
controlP5.Chart : Chart removeFirst()
|
||||
controlP5.Chart : Chart removeFirst(String)
|
||||
controlP5.Chart : Chart removeLast()
|
||||
controlP5.Chart : Chart removeLast(String)
|
||||
controlP5.Chart : Chart setData(String, int, ChartData)
|
||||
controlP5.Chart : Chart setData(int, ChartData)
|
||||
controlP5.Chart : Chart setDataSet(ChartDataSet)
|
||||
controlP5.Chart : Chart setDataSet(String, ChartDataSet)
|
||||
controlP5.Chart : Chart setRange(float, float)
|
||||
controlP5.Chart : Chart setResolution(int)
|
||||
controlP5.Chart : Chart setStrokeWeight(float)
|
||||
controlP5.Chart : Chart setValue(float)
|
||||
controlP5.Chart : Chart setView(int)
|
||||
controlP5.Chart : Chart unshift(String, float)
|
||||
controlP5.Chart : Chart unshift(float)
|
||||
controlP5.Chart : ChartData getData(String, int)
|
||||
controlP5.Chart : ChartDataSet getDataSet(String)
|
||||
controlP5.Chart : LinkedHashMap getDataSet()
|
||||
controlP5.Chart : String getInfo()
|
||||
controlP5.Chart : String toString()
|
||||
controlP5.Chart : float getStrokeWeight()
|
||||
controlP5.Chart : float[] getValuesFrom(String)
|
||||
controlP5.Chart : int getResolution()
|
||||
controlP5.Chart : int size()
|
||||
controlP5.Chart : void onEnter()
|
||||
controlP5.Chart : void onLeave()
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : Chart addCallback(CallbackListener)
|
||||
controlP5.Controller : Chart addListener(ControlListener)
|
||||
controlP5.Controller : Chart addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Chart align(int, int, int, int)
|
||||
controlP5.Controller : Chart bringToFront()
|
||||
controlP5.Controller : Chart bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Chart hide()
|
||||
controlP5.Controller : Chart linebreak()
|
||||
controlP5.Controller : Chart listen(boolean)
|
||||
controlP5.Controller : Chart lock()
|
||||
controlP5.Controller : Chart onChange(CallbackListener)
|
||||
controlP5.Controller : Chart onClick(CallbackListener)
|
||||
controlP5.Controller : Chart onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Chart onDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onDraw(ControllerView)
|
||||
controlP5.Controller : Chart onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onEnter(CallbackListener)
|
||||
controlP5.Controller : Chart onLeave(CallbackListener)
|
||||
controlP5.Controller : Chart onMove(CallbackListener)
|
||||
controlP5.Controller : Chart onPress(CallbackListener)
|
||||
controlP5.Controller : Chart onRelease(CallbackListener)
|
||||
controlP5.Controller : Chart onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Chart onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onWheel(CallbackListener)
|
||||
controlP5.Controller : Chart plugTo(Object)
|
||||
controlP5.Controller : Chart plugTo(Object, String)
|
||||
controlP5.Controller : Chart plugTo(Object[])
|
||||
controlP5.Controller : Chart plugTo(Object[], String)
|
||||
controlP5.Controller : Chart registerProperty(String)
|
||||
controlP5.Controller : Chart registerProperty(String, String)
|
||||
controlP5.Controller : Chart registerTooltip(String)
|
||||
controlP5.Controller : Chart removeBehavior()
|
||||
controlP5.Controller : Chart removeCallback()
|
||||
controlP5.Controller : Chart removeCallback(CallbackListener)
|
||||
controlP5.Controller : Chart removeListener(ControlListener)
|
||||
controlP5.Controller : Chart removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Chart removeListenersFor(int)
|
||||
controlP5.Controller : Chart removeProperty(String)
|
||||
controlP5.Controller : Chart removeProperty(String, String)
|
||||
controlP5.Controller : Chart setArrayValue(float[])
|
||||
controlP5.Controller : Chart setArrayValue(int, float)
|
||||
controlP5.Controller : Chart setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Chart setBroadcast(boolean)
|
||||
controlP5.Controller : Chart setCaptionLabel(String)
|
||||
controlP5.Controller : Chart setColor(CColor)
|
||||
controlP5.Controller : Chart setColorActive(int)
|
||||
controlP5.Controller : Chart setColorBackground(int)
|
||||
controlP5.Controller : Chart setColorCaptionLabel(int)
|
||||
controlP5.Controller : Chart setColorForeground(int)
|
||||
controlP5.Controller : Chart setColorLabel(int)
|
||||
controlP5.Controller : Chart setColorValue(int)
|
||||
controlP5.Controller : Chart setColorValueLabel(int)
|
||||
controlP5.Controller : Chart setDecimalPrecision(int)
|
||||
controlP5.Controller : Chart setDefaultValue(float)
|
||||
controlP5.Controller : Chart setHeight(int)
|
||||
controlP5.Controller : Chart setId(int)
|
||||
controlP5.Controller : Chart setImage(PImage)
|
||||
controlP5.Controller : Chart setImage(PImage, int)
|
||||
controlP5.Controller : Chart setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Chart setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Chart setLabel(String)
|
||||
controlP5.Controller : Chart setLabelVisible(boolean)
|
||||
controlP5.Controller : Chart setLock(boolean)
|
||||
controlP5.Controller : Chart setMax(float)
|
||||
controlP5.Controller : Chart setMin(float)
|
||||
controlP5.Controller : Chart setMouseOver(boolean)
|
||||
controlP5.Controller : Chart setMoveable(boolean)
|
||||
controlP5.Controller : Chart setPosition(float, float)
|
||||
controlP5.Controller : Chart setPosition(float[])
|
||||
controlP5.Controller : Chart setSize(PImage)
|
||||
controlP5.Controller : Chart setSize(int, int)
|
||||
controlP5.Controller : Chart setStringValue(String)
|
||||
controlP5.Controller : Chart setUpdate(boolean)
|
||||
controlP5.Controller : Chart setValue(float)
|
||||
controlP5.Controller : Chart setValueLabel(String)
|
||||
controlP5.Controller : Chart setValueSelf(float)
|
||||
controlP5.Controller : Chart setView(ControllerView)
|
||||
controlP5.Controller : Chart setVisible(boolean)
|
||||
controlP5.Controller : Chart setWidth(int)
|
||||
controlP5.Controller : Chart show()
|
||||
controlP5.Controller : Chart unlock()
|
||||
controlP5.Controller : Chart unplugFrom(Object)
|
||||
controlP5.Controller : Chart unplugFrom(Object[])
|
||||
controlP5.Controller : Chart unregisterTooltip()
|
||||
controlP5.Controller : Chart update()
|
||||
controlP5.Controller : Chart updateSize()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:54
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,242 @@
|
|||
/**
|
||||
* ControlP5 Checkbox
|
||||
* an example demonstrating the use of a checkbox in controlP5.
|
||||
* CheckBox extends the RadioButton class.
|
||||
* to control a checkbox use:
|
||||
* activate(), deactivate(), activateAll(), deactivateAll(), toggle(), getState()
|
||||
*
|
||||
* find a list of public methods available for the Checkbox Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlP5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
CheckBox checkbox;
|
||||
|
||||
int myColorBackground;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
smooth();
|
||||
cp5 = new ControlP5(this);
|
||||
checkbox = cp5.addCheckBox("checkBox")
|
||||
.setPosition(100, 200)
|
||||
.setSize(40, 40)
|
||||
.setItemsPerRow(3)
|
||||
.setSpacingColumn(30)
|
||||
.setSpacingRow(20)
|
||||
.addItem("0", 0)
|
||||
.addItem("50", 50)
|
||||
.addItem("100", 100)
|
||||
.addItem("150", 150)
|
||||
.addItem("200", 200)
|
||||
.addItem("255", 255)
|
||||
;
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
if (key==' ') {
|
||||
checkbox.deactivateAll();
|
||||
}
|
||||
else {
|
||||
for (int i=0;i<6;i++) {
|
||||
// check if key 0-5 have been pressed and toggle
|
||||
// the checkbox item accordingly.
|
||||
if (keyCode==(48 + i)) {
|
||||
// the index of checkbox items start at 0
|
||||
checkbox.toggle(i);
|
||||
println("toggle "+checkbox.getItem(i).getName());
|
||||
// also see
|
||||
// checkbox.activate(index);
|
||||
// checkbox.deactivate(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(170);
|
||||
pushMatrix();
|
||||
translate(width/2 + 200, height/2);
|
||||
stroke(255);
|
||||
strokeWeight(2);
|
||||
fill(myColorBackground);
|
||||
ellipse(0,0,200,200);
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if (theEvent.isFrom(checkbox)) {
|
||||
myColorBackground = 0;
|
||||
print("got an event from "+checkbox.getName()+"\t\n");
|
||||
// checkbox uses arrayValue to store the state of
|
||||
// individual checkbox-items. usage:
|
||||
println(checkbox.getArrayValue());
|
||||
int col = 0;
|
||||
for (int i=0;i<checkbox.getArrayValue().length;i++) {
|
||||
int n = (int)checkbox.getArrayValue()[i];
|
||||
print(n);
|
||||
if(n==1) {
|
||||
myColorBackground += checkbox.getItem(i).internalValue();
|
||||
}
|
||||
}
|
||||
println();
|
||||
}
|
||||
}
|
||||
|
||||
void checkBox(float[] a) {
|
||||
println(a);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the CheckBox Controller
|
||||
use ControlP5.printPublicMethodsFor(CheckBox.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class CheckBox in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.CheckBox : CheckBox addItem(String, float)
|
||||
controlP5.CheckBox : CheckBox addItem(Toggle, float)
|
||||
controlP5.CheckBox : CheckBox deactivateAll()
|
||||
controlP5.CheckBox : CheckBox hideLabels()
|
||||
controlP5.CheckBox : CheckBox plugTo(Object)
|
||||
controlP5.CheckBox : CheckBox plugTo(Object, String)
|
||||
controlP5.CheckBox : CheckBox removeItem(String)
|
||||
controlP5.CheckBox : CheckBox setArrayValue(float[])
|
||||
controlP5.CheckBox : CheckBox setColorLabels(int)
|
||||
controlP5.CheckBox : CheckBox setImage(PImage)
|
||||
controlP5.CheckBox : CheckBox setImage(PImage, int)
|
||||
controlP5.CheckBox : CheckBox setImages(PImage, PImage, PImage)
|
||||
controlP5.CheckBox : CheckBox setItemHeight(int)
|
||||
controlP5.CheckBox : CheckBox setItemWidth(int)
|
||||
controlP5.CheckBox : CheckBox setItemsPerRow(int)
|
||||
controlP5.CheckBox : CheckBox setNoneSelectedAllowed(boolean)
|
||||
controlP5.CheckBox : CheckBox setSize(PImage)
|
||||
controlP5.CheckBox : CheckBox setSize(int, int)
|
||||
controlP5.CheckBox : CheckBox setSpacingColumn(int)
|
||||
controlP5.CheckBox : CheckBox setSpacingRow(int)
|
||||
controlP5.CheckBox : CheckBox showLabels()
|
||||
controlP5.CheckBox : CheckBox toUpperCase(boolean)
|
||||
controlP5.CheckBox : List getItems()
|
||||
controlP5.CheckBox : String getInfo()
|
||||
controlP5.CheckBox : String toString()
|
||||
controlP5.CheckBox : Toggle getItem(int)
|
||||
controlP5.CheckBox : boolean getState(String)
|
||||
controlP5.CheckBox : boolean getState(int)
|
||||
controlP5.CheckBox : void updateLayout()
|
||||
controlP5.ControlGroup : CheckBox activateEvent(boolean)
|
||||
controlP5.ControlGroup : CheckBox addListener(ControlListener)
|
||||
controlP5.ControlGroup : CheckBox removeListener(ControlListener)
|
||||
controlP5.ControlGroup : CheckBox setBackgroundColor(int)
|
||||
controlP5.ControlGroup : CheckBox setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : CheckBox setBarHeight(int)
|
||||
controlP5.ControlGroup : CheckBox setSize(int, int)
|
||||
controlP5.ControlGroup : CheckBox updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : CheckBox add(ControllerInterface)
|
||||
controlP5.ControllerGroup : CheckBox addListener(ControlListener)
|
||||
controlP5.ControllerGroup : CheckBox bringToFront()
|
||||
controlP5.ControllerGroup : CheckBox bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : CheckBox close()
|
||||
controlP5.ControllerGroup : CheckBox disableCollapse()
|
||||
controlP5.ControllerGroup : CheckBox enableCollapse()
|
||||
controlP5.ControllerGroup : CheckBox hide()
|
||||
controlP5.ControllerGroup : CheckBox hideArrow()
|
||||
controlP5.ControllerGroup : CheckBox hideBar()
|
||||
controlP5.ControllerGroup : CheckBox moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : CheckBox moveTo(PApplet)
|
||||
controlP5.ControllerGroup : CheckBox open()
|
||||
controlP5.ControllerGroup : CheckBox registerProperty(String)
|
||||
controlP5.ControllerGroup : CheckBox registerProperty(String, String)
|
||||
controlP5.ControllerGroup : CheckBox remove(CDrawable)
|
||||
controlP5.ControllerGroup : CheckBox remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : CheckBox removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : CheckBox removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : CheckBox removeProperty(String)
|
||||
controlP5.ControllerGroup : CheckBox removeProperty(String, String)
|
||||
controlP5.ControllerGroup : CheckBox setAddress(String)
|
||||
controlP5.ControllerGroup : CheckBox setArrayValue(float[])
|
||||
controlP5.ControllerGroup : CheckBox setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : CheckBox setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : CheckBox setColor(CColor)
|
||||
controlP5.ControllerGroup : CheckBox setColorActive(int)
|
||||
controlP5.ControllerGroup : CheckBox setColorBackground(int)
|
||||
controlP5.ControllerGroup : CheckBox setColorForeground(int)
|
||||
controlP5.ControllerGroup : CheckBox setColorLabel(int)
|
||||
controlP5.ControllerGroup : CheckBox setColorValue(int)
|
||||
controlP5.ControllerGroup : CheckBox setHeight(int)
|
||||
controlP5.ControllerGroup : CheckBox setId(int)
|
||||
controlP5.ControllerGroup : CheckBox setLabel(String)
|
||||
controlP5.ControllerGroup : CheckBox setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : CheckBox setMoveable(boolean)
|
||||
controlP5.ControllerGroup : CheckBox setOpen(boolean)
|
||||
controlP5.ControllerGroup : CheckBox setPosition(float, float)
|
||||
controlP5.ControllerGroup : CheckBox setPosition(float[])
|
||||
controlP5.ControllerGroup : CheckBox setSize(int, int)
|
||||
controlP5.ControllerGroup : CheckBox setStringValue(String)
|
||||
controlP5.ControllerGroup : CheckBox setTitle(String)
|
||||
controlP5.ControllerGroup : CheckBox setUpdate(boolean)
|
||||
controlP5.ControllerGroup : CheckBox setValue(float)
|
||||
controlP5.ControllerGroup : CheckBox setVisible(boolean)
|
||||
controlP5.ControllerGroup : CheckBox setWidth(int)
|
||||
controlP5.ControllerGroup : CheckBox show()
|
||||
controlP5.ControllerGroup : CheckBox showArrow()
|
||||
controlP5.ControllerGroup : CheckBox showBar()
|
||||
controlP5.ControllerGroup : CheckBox update()
|
||||
controlP5.ControllerGroup : CheckBox updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:56
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
/**
|
||||
* ControlP5 Color picker. a simple color picker,
|
||||
* 4 horizontal sliders controlling the RGBA channels of a color.
|
||||
* to grab the current color value, use function getColorValue() of
|
||||
* the color picker.
|
||||
*
|
||||
* find a list of public methods available for the ColorPicker Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlP5
|
||||
*
|
||||
*/
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
ColorPicker cp;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
cp = cp5.addColorPicker("picker")
|
||||
.setPosition(60, 100)
|
||||
.setColorValue(color(255, 128, 0, 128))
|
||||
;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(cp.getColorValue());
|
||||
fill(0, 80);
|
||||
rect(50, 90, 275, 80);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent c) {
|
||||
// when a value change from a ColorPicker is received, extract the ARGB values
|
||||
// from the controller's array value
|
||||
if(c.isFrom(cp)) {
|
||||
int r = int(c.getArrayValue(0));
|
||||
int g = int(c.getArrayValue(1));
|
||||
int b = int(c.getArrayValue(2));
|
||||
int a = int(c.getArrayValue(3));
|
||||
color col = color(r,g,b,a);
|
||||
println("event\talpha:"+a+"\tred:"+r+"\tgreen:"+g+"\tblue:"+b+"\tcol"+col);
|
||||
}
|
||||
}
|
||||
|
||||
// color information from ColorPicker 'picker' are forwarded to the picker(int) function
|
||||
void picker(int col) {
|
||||
println("picker\talpha:"+alpha(col)+"\tred:"+red(col)+"\tgreen:"+green(col)+"\tblue:"+blue(col)+"\tcol"+col);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):
|
||||
// method A to change color
|
||||
cp.setArrayValue(new float[] {120, 0, 120, 255});
|
||||
break;
|
||||
case('2'):
|
||||
// method B to change color
|
||||
cp.setColorValue(color(255, 0, 0, 255));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the ColorPicker Controller
|
||||
use ControlP5.printPublicMethodsFor(ColorPicker.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ColorPicker in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ColorPicker : ColorPicker plugTo(Object)
|
||||
controlP5.ColorPicker : ColorPicker plugTo(Object, String)
|
||||
controlP5.ColorPicker : ColorPicker setArrayValue(float[])
|
||||
controlP5.ColorPicker : ColorPicker setColorValue(int)
|
||||
controlP5.ColorPicker : String getInfo()
|
||||
controlP5.ColorPicker : int getColorValue()
|
||||
controlP5.ControlGroup : ColorPicker activateEvent(boolean)
|
||||
controlP5.ControlGroup : ColorPicker addListener(ControlListener)
|
||||
controlP5.ControlGroup : ColorPicker removeListener(ControlListener)
|
||||
controlP5.ControlGroup : ColorPicker setBackgroundColor(int)
|
||||
controlP5.ControlGroup : ColorPicker setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : ColorPicker setBarHeight(int)
|
||||
controlP5.ControlGroup : ColorPicker setSize(int, int)
|
||||
controlP5.ControlGroup : ColorPicker updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ColorPicker add(ControllerInterface)
|
||||
controlP5.ControllerGroup : ColorPicker addListener(ControlListener)
|
||||
controlP5.ControllerGroup : ColorPicker bringToFront()
|
||||
controlP5.ControllerGroup : ColorPicker bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : ColorPicker close()
|
||||
controlP5.ControllerGroup : ColorPicker disableCollapse()
|
||||
controlP5.ControllerGroup : ColorPicker enableCollapse()
|
||||
controlP5.ControllerGroup : ColorPicker hide()
|
||||
controlP5.ControllerGroup : ColorPicker hideArrow()
|
||||
controlP5.ControllerGroup : ColorPicker hideBar()
|
||||
controlP5.ControllerGroup : ColorPicker moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : ColorPicker moveTo(PApplet)
|
||||
controlP5.ControllerGroup : ColorPicker open()
|
||||
controlP5.ControllerGroup : ColorPicker registerProperty(String)
|
||||
controlP5.ControllerGroup : ColorPicker registerProperty(String, String)
|
||||
controlP5.ControllerGroup : ColorPicker remove(CDrawable)
|
||||
controlP5.ControllerGroup : ColorPicker remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : ColorPicker removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ColorPicker removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : ColorPicker removeProperty(String)
|
||||
controlP5.ControllerGroup : ColorPicker removeProperty(String, String)
|
||||
controlP5.ControllerGroup : ColorPicker setAddress(String)
|
||||
controlP5.ControllerGroup : ColorPicker setArrayValue(float[])
|
||||
controlP5.ControllerGroup : ColorPicker setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : ColorPicker setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : ColorPicker setColor(CColor)
|
||||
controlP5.ControllerGroup : ColorPicker setColorActive(int)
|
||||
controlP5.ControllerGroup : ColorPicker setColorBackground(int)
|
||||
controlP5.ControllerGroup : ColorPicker setColorForeground(int)
|
||||
controlP5.ControllerGroup : ColorPicker setColorLabel(int)
|
||||
controlP5.ControllerGroup : ColorPicker setColorValue(int)
|
||||
controlP5.ControllerGroup : ColorPicker setHeight(int)
|
||||
controlP5.ControllerGroup : ColorPicker setId(int)
|
||||
controlP5.ControllerGroup : ColorPicker setLabel(String)
|
||||
controlP5.ControllerGroup : ColorPicker setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : ColorPicker setMoveable(boolean)
|
||||
controlP5.ControllerGroup : ColorPicker setOpen(boolean)
|
||||
controlP5.ControllerGroup : ColorPicker setPosition(float, float)
|
||||
controlP5.ControllerGroup : ColorPicker setPosition(float[])
|
||||
controlP5.ControllerGroup : ColorPicker setSize(int, int)
|
||||
controlP5.ControllerGroup : ColorPicker setStringValue(String)
|
||||
controlP5.ControllerGroup : ColorPicker setTitle(String)
|
||||
controlP5.ControllerGroup : ColorPicker setUpdate(boolean)
|
||||
controlP5.ControllerGroup : ColorPicker setValue(float)
|
||||
controlP5.ControllerGroup : ColorPicker setVisible(boolean)
|
||||
controlP5.ControllerGroup : ColorPicker setWidth(int)
|
||||
controlP5.ControllerGroup : ColorPicker show()
|
||||
controlP5.ControllerGroup : ColorPicker showArrow()
|
||||
controlP5.ControllerGroup : ColorPicker showBar()
|
||||
controlP5.ControllerGroup : ColorPicker update()
|
||||
controlP5.ControllerGroup : ColorPicker updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:20:58
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,203 @@
|
|||
/**
|
||||
* ControlP5 ColorWheel
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Group Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2014
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
cp5 = new ControlP5( this );
|
||||
cp5.addColorWheel("c" , 250 , 10 , 200 ).setRGB(color(128,0,255));
|
||||
noStroke();
|
||||
}
|
||||
|
||||
int c = color(100);
|
||||
|
||||
void draw() {
|
||||
background(50);
|
||||
fill( c );
|
||||
rect(0,240,width,200);
|
||||
println(cp5.get(ColorWheel.class,"c").getRGB());
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the ColorWheel Controller
|
||||
use ControlP5.printPublicMethodsFor(ColorWheel.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ColorWheel in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ColorWheel : ColorWheel scrolled(int)
|
||||
controlP5.ColorWheel : ColorWheel setAlpha(int)
|
||||
controlP5.ColorWheel : ColorWheel setHSL(double, double, double)
|
||||
controlP5.ColorWheel : ColorWheel setRGB(int)
|
||||
controlP5.ColorWheel : double[] RGBtoHSL(int)
|
||||
controlP5.ColorWheel : double[] RGBtoHSL(int, int, int)
|
||||
controlP5.ColorWheel : int HSLtoRGB(double, double, double)
|
||||
controlP5.ColorWheel : int HSLtoRGB(double[])
|
||||
controlP5.ColorWheel : int HSVtoRGB(double, double, double)
|
||||
controlP5.ColorWheel : int HSVtoRGB(double[])
|
||||
controlP5.ColorWheel : int a()
|
||||
controlP5.ColorWheel : int b()
|
||||
controlP5.ColorWheel : int g()
|
||||
controlP5.ColorWheel : int getRGB()
|
||||
controlP5.ColorWheel : int r()
|
||||
controlP5.ColorWheel : void onDrag()
|
||||
controlP5.ColorWheel : void onEndDrag()
|
||||
controlP5.ColorWheel : void onPress()
|
||||
controlP5.ColorWheel : void onRelease()
|
||||
controlP5.ColorWheel : void onStartDrag()
|
||||
controlP5.ColorWheel : void setHue(double)
|
||||
controlP5.ColorWheel : void setLightness(double)
|
||||
controlP5.ColorWheel : void setSaturation(double)
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ColorWheel addCallback(CallbackListener)
|
||||
controlP5.Controller : ColorWheel addListener(ControlListener)
|
||||
controlP5.Controller : ColorWheel addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ColorWheel align(int, int, int, int)
|
||||
controlP5.Controller : ColorWheel bringToFront()
|
||||
controlP5.Controller : ColorWheel bringToFront(ControllerInterface)
|
||||
controlP5.Controller : ColorWheel hide()
|
||||
controlP5.Controller : ColorWheel linebreak()
|
||||
controlP5.Controller : ColorWheel listen(boolean)
|
||||
controlP5.Controller : ColorWheel lock()
|
||||
controlP5.Controller : ColorWheel onChange(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onClick(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onDoublePress(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onDrag(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onDraw(ControllerView)
|
||||
controlP5.Controller : ColorWheel onEndDrag(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onEnter(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onLeave(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onMove(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onPress(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onRelease(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onStartDrag(CallbackListener)
|
||||
controlP5.Controller : ColorWheel onWheel(CallbackListener)
|
||||
controlP5.Controller : ColorWheel plugTo(Object)
|
||||
controlP5.Controller : ColorWheel plugTo(Object, String)
|
||||
controlP5.Controller : ColorWheel plugTo(Object[])
|
||||
controlP5.Controller : ColorWheel plugTo(Object[], String)
|
||||
controlP5.Controller : ColorWheel registerProperty(String)
|
||||
controlP5.Controller : ColorWheel registerProperty(String, String)
|
||||
controlP5.Controller : ColorWheel registerTooltip(String)
|
||||
controlP5.Controller : ColorWheel removeBehavior()
|
||||
controlP5.Controller : ColorWheel removeCallback()
|
||||
controlP5.Controller : ColorWheel removeCallback(CallbackListener)
|
||||
controlP5.Controller : ColorWheel removeListener(ControlListener)
|
||||
controlP5.Controller : ColorWheel removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ColorWheel removeListenersFor(int)
|
||||
controlP5.Controller : ColorWheel removeProperty(String)
|
||||
controlP5.Controller : ColorWheel removeProperty(String, String)
|
||||
controlP5.Controller : ColorWheel setArrayValue(float[])
|
||||
controlP5.Controller : ColorWheel setArrayValue(int, float)
|
||||
controlP5.Controller : ColorWheel setBehavior(ControlBehavior)
|
||||
controlP5.Controller : ColorWheel setBroadcast(boolean)
|
||||
controlP5.Controller : ColorWheel setCaptionLabel(String)
|
||||
controlP5.Controller : ColorWheel setColor(CColor)
|
||||
controlP5.Controller : ColorWheel setColorActive(int)
|
||||
controlP5.Controller : ColorWheel setColorBackground(int)
|
||||
controlP5.Controller : ColorWheel setColorCaptionLabel(int)
|
||||
controlP5.Controller : ColorWheel setColorForeground(int)
|
||||
controlP5.Controller : ColorWheel setColorLabel(int)
|
||||
controlP5.Controller : ColorWheel setColorValue(int)
|
||||
controlP5.Controller : ColorWheel setColorValueLabel(int)
|
||||
controlP5.Controller : ColorWheel setDecimalPrecision(int)
|
||||
controlP5.Controller : ColorWheel setDefaultValue(float)
|
||||
controlP5.Controller : ColorWheel setHeight(int)
|
||||
controlP5.Controller : ColorWheel setId(int)
|
||||
controlP5.Controller : ColorWheel setImage(PImage)
|
||||
controlP5.Controller : ColorWheel setImage(PImage, int)
|
||||
controlP5.Controller : ColorWheel setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : ColorWheel setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : ColorWheel setLabel(String)
|
||||
controlP5.Controller : ColorWheel setLabelVisible(boolean)
|
||||
controlP5.Controller : ColorWheel setLock(boolean)
|
||||
controlP5.Controller : ColorWheel setMax(float)
|
||||
controlP5.Controller : ColorWheel setMin(float)
|
||||
controlP5.Controller : ColorWheel setMouseOver(boolean)
|
||||
controlP5.Controller : ColorWheel setMoveable(boolean)
|
||||
controlP5.Controller : ColorWheel setPosition(float, float)
|
||||
controlP5.Controller : ColorWheel setPosition(float[])
|
||||
controlP5.Controller : ColorWheel setSize(PImage)
|
||||
controlP5.Controller : ColorWheel setSize(int, int)
|
||||
controlP5.Controller : ColorWheel setStringValue(String)
|
||||
controlP5.Controller : ColorWheel setUpdate(boolean)
|
||||
controlP5.Controller : ColorWheel setValue(float)
|
||||
controlP5.Controller : ColorWheel setValueLabel(String)
|
||||
controlP5.Controller : ColorWheel setValueSelf(float)
|
||||
controlP5.Controller : ColorWheel setView(ControllerView)
|
||||
controlP5.Controller : ColorWheel setVisible(boolean)
|
||||
controlP5.Controller : ColorWheel setWidth(int)
|
||||
controlP5.Controller : ColorWheel show()
|
||||
controlP5.Controller : ColorWheel unlock()
|
||||
controlP5.Controller : ColorWheel unplugFrom(Object)
|
||||
controlP5.Controller : ColorWheel unplugFrom(Object[])
|
||||
controlP5.Controller : ColorWheel unregisterTooltip()
|
||||
controlP5.Controller : ColorWheel update()
|
||||
controlP5.Controller : ColorWheel updateSize()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:00
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* ControlP5 Timer
|
||||
* by andreas schlegel, 2009
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
ControlTimer c;
|
||||
Textlabel t;
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
frameRate(30);
|
||||
cp5 = new ControlP5(this);
|
||||
c = new ControlTimer();
|
||||
t = new Textlabel(cp5,"--",100,100);
|
||||
c.setSpeedOfTime(1);
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
t.setValue(c.toString());
|
||||
t.draw(this);
|
||||
t.setPosition(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
void mousePressed() {
|
||||
c.reset();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControlTimer Controller
|
||||
use ControlP5.printPublicMethodsFor(ControlTimer.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControlTimer in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlTimer : String toString()
|
||||
controlP5.ControlTimer : int day()
|
||||
controlP5.ControlTimer : int hour()
|
||||
controlP5.ControlTimer : int millis()
|
||||
controlP5.ControlTimer : int minute()
|
||||
controlP5.ControlTimer : int second()
|
||||
controlP5.ControlTimer : long time()
|
||||
controlP5.ControlTimer : void reset()
|
||||
controlP5.ControlTimer : void setSpeedOfTime(float)
|
||||
controlP5.ControlTimer : void update()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:02
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* ControlP5 Properties
|
||||
*
|
||||
*
|
||||
* saves controller values to a properties-file
|
||||
* loads controller values from a properties-file
|
||||
*
|
||||
* Properties will only save values not the Controller itself.
|
||||
*
|
||||
* Also take a look at the use/ControlP5snapshot example to
|
||||
* save controller values to memory.
|
||||
*
|
||||
* Use ControllerProperties to load and save serialized controller properties
|
||||
* to a properties file.
|
||||
* The controllers implementing save/load properties so far are
|
||||
* Slider, Knob, Numberbox, Toggle, Checkbox, RadioButton, Textlabel,
|
||||
* Matrix, Range, Textarea, ListBox, Dropdown, ColorPicker.
|
||||
* Properties are currently saved in the java serialization format.
|
||||
*
|
||||
* saveProperties(String theFilename) and loadProperties(String theFilename)
|
||||
* by default properties will be saved to your sketch folder as controlP5.ser
|
||||
* if that file already exists it will be overwritten. for custom property files
|
||||
* see the comments inside keyPressed() below.
|
||||
*
|
||||
* find a list of public methods available for the ControllerProperties class
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* default properties load/save key combinations are
|
||||
* alt+shift+l to load properties
|
||||
* alt+shift+s to save properties
|
||||
*
|
||||
* by andreas schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
public int myColor = color(0, 0, 0);
|
||||
|
||||
public int sliderValue = 100;
|
||||
public int sliderTicks1 = 100;
|
||||
public int sliderTicks2 = 30;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addSlider("slider")
|
||||
.setBroadcast(false)
|
||||
.setRange(0, 200)
|
||||
.setPosition(20, 100)
|
||||
.setSize(10, 100)
|
||||
.setBroadcast(true)
|
||||
.setValue(100)
|
||||
;
|
||||
|
||||
cp5.addSlider("sliderTicks1")
|
||||
.setRange(0, 255)
|
||||
.setPosition(100, 100)
|
||||
.setSize(10, 100)
|
||||
.setNumberOfTickMarks(5)
|
||||
;
|
||||
|
||||
cp5.addSlider("sliderValue")
|
||||
.setRange(0, 255)
|
||||
.setValue(128)
|
||||
.setPosition(200, 180)
|
||||
.setSize(100, 10)
|
||||
;
|
||||
|
||||
cp5.addSlider("sliderTicks2")
|
||||
.setRange(0, 255)
|
||||
.setValue(128)
|
||||
.setPosition(200, 220)
|
||||
.setSize(100, 10)
|
||||
.setNumberOfTickMarks(7)
|
||||
.setSliderMode(Slider.FLEXIBLE)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(sliderTicks1);
|
||||
|
||||
fill(sliderValue);
|
||||
rect(0, 0, width, 100);
|
||||
|
||||
fill(myColor);
|
||||
rect(0, 300, width, 70);
|
||||
|
||||
fill(sliderTicks2);
|
||||
rect(0, 370, width, 30);
|
||||
}
|
||||
|
||||
public void slider(float theColor) {
|
||||
myColor = color(theColor);
|
||||
println("a slider event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
// default properties load/save key combinations are
|
||||
// alt+shift+l to load properties
|
||||
// alt+shift+s to save properties
|
||||
if (key=='1') {
|
||||
cp5.saveProperties(("hello.properties"));
|
||||
}
|
||||
else if (key=='2') {
|
||||
cp5.loadProperties(("hello.properties"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControllerProperties Controller
|
||||
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControllerProperties in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControllerProperties : ArrayList getSnapshotIndices()
|
||||
controlP5.ControllerProperties : ControllerProperties addSet(String)
|
||||
controlP5.ControllerProperties : ControllerProperties delete(ControllerProperty)
|
||||
controlP5.ControllerProperties : ControllerProperties getSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties move(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties move(ControllerProperty, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties only(ControllerProperty, String)
|
||||
controlP5.ControllerProperties : ControllerProperties print()
|
||||
controlP5.ControllerProperties : ControllerProperties register(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties removeSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties saveSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties saveSnapshotAs(String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties setSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties updateSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||
controlP5.ControllerProperties : Map get()
|
||||
controlP5.ControllerProperties : String toString()
|
||||
controlP5.ControllerProperties : boolean load()
|
||||
controlP5.ControllerProperties : boolean load(String)
|
||||
controlP5.ControllerProperties : boolean save()
|
||||
controlP5.ControllerProperties : boolean saveAs(String)
|
||||
controlP5.ControllerProperties : void setFormat(PropertiesStorageFormat)
|
||||
controlP5.ControllerProperties : void setFormat(String)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:03
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"/sliderValue": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 128
|
||||
},
|
||||
"/slider": {
|
||||
"min": 0,
|
||||
"max": 200,
|
||||
"value": 100
|
||||
},
|
||||
"/sliderTicks1": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 0
|
||||
},
|
||||
"/sliderTicks2": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 127.5
|
||||
}
|
||||
}
|
|
@ -0,0 +1,311 @@
|
|||
/**
|
||||
*
|
||||
* DEPRECATED, use ScrollableList instead.
|
||||
*
|
||||
* Control5 DropdownList
|
||||
* A dropdownList controller, extends the ListBox controller.
|
||||
* the most recently selected dropdownlist item is displayed inside
|
||||
* the menu bar of the DropdownList.
|
||||
*
|
||||
* find a list of public methods available for the DropdownList Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
*
|
||||
* by andreas schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
DropdownList d1, d2;
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
void setup() {
|
||||
size(700, 400 );
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// DropdownList is DEPRECATED,
|
||||
// use ScrollableList instead,
|
||||
// see example ControlP5scrollableList
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// create a DropdownList,
|
||||
d1 = cp5.addDropdownList("myList-d1")
|
||||
.setPosition(100, 100)
|
||||
;
|
||||
|
||||
customize(d1); // customize the first list
|
||||
|
||||
// create a second DropdownList
|
||||
d2 = cp5.addDropdownList("myList-d2")
|
||||
.setPosition(400, 100)
|
||||
.setSize(200,200)
|
||||
;
|
||||
|
||||
customize(d2); // customize the second list
|
||||
}
|
||||
|
||||
|
||||
void customize(DropdownList ddl) {
|
||||
// a convenience function to customize a DropdownList
|
||||
ddl.setBackgroundColor(color(190));
|
||||
ddl.setItemHeight(20);
|
||||
ddl.setBarHeight(15);
|
||||
ddl.getCaptionLabel().set("dropdown");
|
||||
for (int i=0;i<40;i++) {
|
||||
ddl.addItem("item "+i, i);
|
||||
}
|
||||
//ddl.scroll(0);
|
||||
ddl.setColorBackground(color(60));
|
||||
ddl.setColorActive(color(255, 128));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
// some key events to change the properties of DropdownList d1
|
||||
if (key=='1') {
|
||||
// set the height of a pulldown menu, should always be a multiple of itemHeight
|
||||
d1.setHeight(210);
|
||||
}
|
||||
else if (key=='2') {
|
||||
// set the height of a pulldown menu, should always be a multiple of itemHeight
|
||||
d1.setHeight(120);
|
||||
}
|
||||
else if (key=='3') {
|
||||
// set the height of a pulldown menu item, should always be a fraction of the pulldown menu
|
||||
d1.setItemHeight(30);
|
||||
}
|
||||
else if (key=='4') {
|
||||
// set the height of a pulldown menu item, should always be a fraction of the pulldown menu
|
||||
d1.setItemHeight(12);
|
||||
d1.setBackgroundColor(color(255));
|
||||
}
|
||||
else if (key=='5') {
|
||||
// add new items to the pulldown menu
|
||||
int n = (int)(random(100000));
|
||||
d1.addItem("item "+n, n);
|
||||
}
|
||||
else if (key=='6') {
|
||||
// remove items from the pulldown menu by name
|
||||
d1.removeItem("item "+cnt);
|
||||
cnt++;
|
||||
}
|
||||
else if (key=='7') {
|
||||
d1.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
// DropdownList is of type ControlGroup.
|
||||
// A controlEvent will be triggered from inside the ControlGroup class.
|
||||
// therefore you need to check the originator of the Event with
|
||||
// if (theEvent.isGroup())
|
||||
// to avoid an error message thrown by controlP5.
|
||||
|
||||
if (theEvent.isGroup()) {
|
||||
// check if the Event was triggered from a ControlGroup
|
||||
println("event from group : "+theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
|
||||
}
|
||||
else if (theEvent.isController()) {
|
||||
println("event from controller : "+theEvent.getController().getValue()+" from "+theEvent.getController());
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(128);
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the DropdownList Controller
|
||||
use ControlP5.printPublicMethodsFor(DropdownList.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class DropdownList in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : DropdownList addCallback(CallbackListener)
|
||||
controlP5.Controller : DropdownList addListener(ControlListener)
|
||||
controlP5.Controller : DropdownList addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : DropdownList align(int, int, int, int)
|
||||
controlP5.Controller : DropdownList bringToFront()
|
||||
controlP5.Controller : DropdownList bringToFront(ControllerInterface)
|
||||
controlP5.Controller : DropdownList hide()
|
||||
controlP5.Controller : DropdownList linebreak()
|
||||
controlP5.Controller : DropdownList listen(boolean)
|
||||
controlP5.Controller : DropdownList lock()
|
||||
controlP5.Controller : DropdownList onChange(CallbackListener)
|
||||
controlP5.Controller : DropdownList onClick(CallbackListener)
|
||||
controlP5.Controller : DropdownList onDoublePress(CallbackListener)
|
||||
controlP5.Controller : DropdownList onDrag(CallbackListener)
|
||||
controlP5.Controller : DropdownList onDraw(ControllerView)
|
||||
controlP5.Controller : DropdownList onEndDrag(CallbackListener)
|
||||
controlP5.Controller : DropdownList onEnter(CallbackListener)
|
||||
controlP5.Controller : DropdownList onLeave(CallbackListener)
|
||||
controlP5.Controller : DropdownList onMove(CallbackListener)
|
||||
controlP5.Controller : DropdownList onPress(CallbackListener)
|
||||
controlP5.Controller : DropdownList onRelease(CallbackListener)
|
||||
controlP5.Controller : DropdownList onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : DropdownList onStartDrag(CallbackListener)
|
||||
controlP5.Controller : DropdownList onWheel(CallbackListener)
|
||||
controlP5.Controller : DropdownList plugTo(Object)
|
||||
controlP5.Controller : DropdownList plugTo(Object, String)
|
||||
controlP5.Controller : DropdownList plugTo(Object[])
|
||||
controlP5.Controller : DropdownList plugTo(Object[], String)
|
||||
controlP5.Controller : DropdownList registerProperty(String)
|
||||
controlP5.Controller : DropdownList registerProperty(String, String)
|
||||
controlP5.Controller : DropdownList registerTooltip(String)
|
||||
controlP5.Controller : DropdownList removeBehavior()
|
||||
controlP5.Controller : DropdownList removeCallback()
|
||||
controlP5.Controller : DropdownList removeCallback(CallbackListener)
|
||||
controlP5.Controller : DropdownList removeListener(ControlListener)
|
||||
controlP5.Controller : DropdownList removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : DropdownList removeListenersFor(int)
|
||||
controlP5.Controller : DropdownList removeProperty(String)
|
||||
controlP5.Controller : DropdownList removeProperty(String, String)
|
||||
controlP5.Controller : DropdownList setArrayValue(float[])
|
||||
controlP5.Controller : DropdownList setArrayValue(int, float)
|
||||
controlP5.Controller : DropdownList setBehavior(ControlBehavior)
|
||||
controlP5.Controller : DropdownList setBroadcast(boolean)
|
||||
controlP5.Controller : DropdownList setCaptionLabel(String)
|
||||
controlP5.Controller : DropdownList setColor(CColor)
|
||||
controlP5.Controller : DropdownList setColorActive(int)
|
||||
controlP5.Controller : DropdownList setColorBackground(int)
|
||||
controlP5.Controller : DropdownList setColorCaptionLabel(int)
|
||||
controlP5.Controller : DropdownList setColorForeground(int)
|
||||
controlP5.Controller : DropdownList setColorLabel(int)
|
||||
controlP5.Controller : DropdownList setColorValue(int)
|
||||
controlP5.Controller : DropdownList setColorValueLabel(int)
|
||||
controlP5.Controller : DropdownList setDecimalPrecision(int)
|
||||
controlP5.Controller : DropdownList setDefaultValue(float)
|
||||
controlP5.Controller : DropdownList setHeight(int)
|
||||
controlP5.Controller : DropdownList setId(int)
|
||||
controlP5.Controller : DropdownList setImage(PImage)
|
||||
controlP5.Controller : DropdownList setImage(PImage, int)
|
||||
controlP5.Controller : DropdownList setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : DropdownList setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : DropdownList setLabel(String)
|
||||
controlP5.Controller : DropdownList setLabelVisible(boolean)
|
||||
controlP5.Controller : DropdownList setLock(boolean)
|
||||
controlP5.Controller : DropdownList setMax(float)
|
||||
controlP5.Controller : DropdownList setMin(float)
|
||||
controlP5.Controller : DropdownList setMouseOver(boolean)
|
||||
controlP5.Controller : DropdownList setMoveable(boolean)
|
||||
controlP5.Controller : DropdownList setPosition(float, float)
|
||||
controlP5.Controller : DropdownList setPosition(float[])
|
||||
controlP5.Controller : DropdownList setSize(PImage)
|
||||
controlP5.Controller : DropdownList setSize(int, int)
|
||||
controlP5.Controller : DropdownList setStringValue(String)
|
||||
controlP5.Controller : DropdownList setUpdate(boolean)
|
||||
controlP5.Controller : DropdownList setValue(float)
|
||||
controlP5.Controller : DropdownList setValueLabel(String)
|
||||
controlP5.Controller : DropdownList setValueSelf(float)
|
||||
controlP5.Controller : DropdownList setView(ControllerView)
|
||||
controlP5.Controller : DropdownList setVisible(boolean)
|
||||
controlP5.Controller : DropdownList setWidth(int)
|
||||
controlP5.Controller : DropdownList show()
|
||||
controlP5.Controller : DropdownList unlock()
|
||||
controlP5.Controller : DropdownList unplugFrom(Object)
|
||||
controlP5.Controller : DropdownList unplugFrom(Object[])
|
||||
controlP5.Controller : DropdownList unregisterTooltip()
|
||||
controlP5.Controller : DropdownList update()
|
||||
controlP5.Controller : DropdownList updateSize()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.DropdownList : DropdownList addItem(String, Object)
|
||||
controlP5.DropdownList : DropdownList addItems(List)
|
||||
controlP5.DropdownList : DropdownList addItems(Map)
|
||||
controlP5.DropdownList : DropdownList addItems(String[])
|
||||
controlP5.DropdownList : DropdownList clear()
|
||||
controlP5.DropdownList : DropdownList close()
|
||||
controlP5.DropdownList : DropdownList open()
|
||||
controlP5.DropdownList : DropdownList removeItem(String)
|
||||
controlP5.DropdownList : DropdownList removeItems(List)
|
||||
controlP5.DropdownList : DropdownList setBackgroundColor(int)
|
||||
controlP5.DropdownList : DropdownList setBarHeight(int)
|
||||
controlP5.DropdownList : DropdownList setBarVisible(boolean)
|
||||
controlP5.DropdownList : DropdownList setItemHeight(int)
|
||||
controlP5.DropdownList : DropdownList setItems(List)
|
||||
controlP5.DropdownList : DropdownList setItems(Map)
|
||||
controlP5.DropdownList : DropdownList setItems(String[])
|
||||
controlP5.DropdownList : DropdownList setOpen(boolean)
|
||||
controlP5.DropdownList : DropdownList setScrollSensitivity(float)
|
||||
controlP5.DropdownList : DropdownList setType(int)
|
||||
controlP5.DropdownList : List getItems()
|
||||
controlP5.DropdownList : Map getItem(String)
|
||||
controlP5.DropdownList : Map getItem(int)
|
||||
controlP5.DropdownList : boolean isBarVisible()
|
||||
controlP5.DropdownList : boolean isOpen()
|
||||
controlP5.DropdownList : int getBackgroundColor()
|
||||
controlP5.DropdownList : int getBarHeight()
|
||||
controlP5.DropdownList : int getHeight()
|
||||
controlP5.DropdownList : void controlEvent(ControlEvent)
|
||||
controlP5.DropdownList : void keyEvent(KeyEvent)
|
||||
controlP5.DropdownList : void setDirection(int)
|
||||
controlP5.DropdownList : void updateItemIndexOffset()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:05
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,235 @@
|
|||
/**
|
||||
* 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(800,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(250,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)
|
||||
;
|
||||
|
||||
Group g3 = cp5.addGroup("g3")
|
||||
.setPosition(600,100)
|
||||
.setSize(150,200)
|
||||
.setBackgroundColor(color(255,100))
|
||||
;
|
||||
|
||||
|
||||
cp5.addScrollableList("list")
|
||||
.setPosition(10,10)
|
||||
.setSize(130,100)
|
||||
.setGroup(g3)
|
||||
.addItems(java.util.Arrays.asList("a","b","c","d","e","f","g"))
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if(theEvent.isGroup()) {
|
||||
println("got an event from group "
|
||||
+theEvent.getGroup().getName()
|
||||
+", isOpen? "+theEvent.getGroup().isOpen()
|
||||
);
|
||||
|
||||
} else if (theEvent.isController()){
|
||||
println("got something from a controller "
|
||||
+theEvent.getController().getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
if(key==' ') {
|
||||
if(cp5.getGroup("g1")!=null) {
|
||||
cp5.getGroup("g1").remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Group Controller
|
||||
use ControlP5.printPublicMethodsFor(Group.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Group in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlGroup : Group activateEvent(boolean)
|
||||
controlP5.ControlGroup : Group addListener(ControlListener)
|
||||
controlP5.ControlGroup : Group removeListener(ControlListener)
|
||||
controlP5.ControlGroup : Group setBackgroundColor(int)
|
||||
controlP5.ControlGroup : Group setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : Group setBarHeight(int)
|
||||
controlP5.ControlGroup : Group setSize(int, int)
|
||||
controlP5.ControlGroup : Group updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Group add(ControllerInterface)
|
||||
controlP5.ControllerGroup : Group addListener(ControlListener)
|
||||
controlP5.ControllerGroup : Group bringToFront()
|
||||
controlP5.ControllerGroup : Group bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : Group close()
|
||||
controlP5.ControllerGroup : Group disableCollapse()
|
||||
controlP5.ControllerGroup : Group enableCollapse()
|
||||
controlP5.ControllerGroup : Group hide()
|
||||
controlP5.ControllerGroup : Group hideArrow()
|
||||
controlP5.ControllerGroup : Group hideBar()
|
||||
controlP5.ControllerGroup : Group moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : Group moveTo(PApplet)
|
||||
controlP5.ControllerGroup : Group open()
|
||||
controlP5.ControllerGroup : Group registerProperty(String)
|
||||
controlP5.ControllerGroup : Group registerProperty(String, String)
|
||||
controlP5.ControllerGroup : Group remove(CDrawable)
|
||||
controlP5.ControllerGroup : Group remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : Group removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : Group removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : Group removeProperty(String)
|
||||
controlP5.ControllerGroup : Group removeProperty(String, String)
|
||||
controlP5.ControllerGroup : Group setAddress(String)
|
||||
controlP5.ControllerGroup : Group setArrayValue(float[])
|
||||
controlP5.ControllerGroup : Group setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : Group setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : Group setColor(CColor)
|
||||
controlP5.ControllerGroup : Group setColorActive(int)
|
||||
controlP5.ControllerGroup : Group setColorBackground(int)
|
||||
controlP5.ControllerGroup : Group setColorForeground(int)
|
||||
controlP5.ControllerGroup : Group setColorLabel(int)
|
||||
controlP5.ControllerGroup : Group setColorValue(int)
|
||||
controlP5.ControllerGroup : Group setHeight(int)
|
||||
controlP5.ControllerGroup : Group setId(int)
|
||||
controlP5.ControllerGroup : Group setLabel(String)
|
||||
controlP5.ControllerGroup : Group setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : Group setMoveable(boolean)
|
||||
controlP5.ControllerGroup : Group setOpen(boolean)
|
||||
controlP5.ControllerGroup : Group setPosition(float, float)
|
||||
controlP5.ControllerGroup : Group setPosition(float[])
|
||||
controlP5.ControllerGroup : Group setSize(int, int)
|
||||
controlP5.ControllerGroup : Group setStringValue(String)
|
||||
controlP5.ControllerGroup : Group setTitle(String)
|
||||
controlP5.ControllerGroup : Group setUpdate(boolean)
|
||||
controlP5.ControllerGroup : Group setValue(float)
|
||||
controlP5.ControllerGroup : Group setVisible(boolean)
|
||||
controlP5.ControllerGroup : Group setWidth(int)
|
||||
controlP5.ControllerGroup : Group show()
|
||||
controlP5.ControllerGroup : Group showArrow()
|
||||
controlP5.ControllerGroup : Group showBar()
|
||||
controlP5.ControllerGroup : Group update()
|
||||
controlP5.ControllerGroup : Group updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:07
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,218 @@
|
|||
/**
|
||||
* ControlP5 Icon
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Group Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2014
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(800,400);
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addIcon("icon",10)
|
||||
.setPosition(100,100)
|
||||
.setSize(70,50)
|
||||
.setRoundedCorners(20)
|
||||
.setFont(createFont("fontawesome-webfont.ttf", 40))
|
||||
.setFontIcons(#00f205,#00f204)
|
||||
//.setScale(0.9,1)
|
||||
.setSwitch(true)
|
||||
.setColorBackground(color(255,100))
|
||||
.hideBackground()
|
||||
;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(220);
|
||||
}
|
||||
|
||||
void icon(boolean theValue) {
|
||||
println("got an event for icon", theValue);
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the Icon Controller
|
||||
use ControlP5.printPublicMethodsFor(Icon.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Icon in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Icon addCallback(CallbackListener)
|
||||
controlP5.Controller : Icon addListener(ControlListener)
|
||||
controlP5.Controller : Icon addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Icon align(int, int, int, int)
|
||||
controlP5.Controller : Icon bringToFront()
|
||||
controlP5.Controller : Icon bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Icon hide()
|
||||
controlP5.Controller : Icon linebreak()
|
||||
controlP5.Controller : Icon listen(boolean)
|
||||
controlP5.Controller : Icon lock()
|
||||
controlP5.Controller : Icon onChange(CallbackListener)
|
||||
controlP5.Controller : Icon onClick(CallbackListener)
|
||||
controlP5.Controller : Icon onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Icon onDrag(CallbackListener)
|
||||
controlP5.Controller : Icon onDraw(ControllerView)
|
||||
controlP5.Controller : Icon onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Icon onEnter(CallbackListener)
|
||||
controlP5.Controller : Icon onLeave(CallbackListener)
|
||||
controlP5.Controller : Icon onMove(CallbackListener)
|
||||
controlP5.Controller : Icon onPress(CallbackListener)
|
||||
controlP5.Controller : Icon onRelease(CallbackListener)
|
||||
controlP5.Controller : Icon onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Icon onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Icon onWheel(CallbackListener)
|
||||
controlP5.Controller : Icon plugTo(Object)
|
||||
controlP5.Controller : Icon plugTo(Object, String)
|
||||
controlP5.Controller : Icon plugTo(Object[])
|
||||
controlP5.Controller : Icon plugTo(Object[], String)
|
||||
controlP5.Controller : Icon registerProperty(String)
|
||||
controlP5.Controller : Icon registerProperty(String, String)
|
||||
controlP5.Controller : Icon registerTooltip(String)
|
||||
controlP5.Controller : Icon removeBehavior()
|
||||
controlP5.Controller : Icon removeCallback()
|
||||
controlP5.Controller : Icon removeCallback(CallbackListener)
|
||||
controlP5.Controller : Icon removeListener(ControlListener)
|
||||
controlP5.Controller : Icon removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Icon removeListenersFor(int)
|
||||
controlP5.Controller : Icon removeProperty(String)
|
||||
controlP5.Controller : Icon removeProperty(String, String)
|
||||
controlP5.Controller : Icon setArrayValue(float[])
|
||||
controlP5.Controller : Icon setArrayValue(int, float)
|
||||
controlP5.Controller : Icon setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Icon setBroadcast(boolean)
|
||||
controlP5.Controller : Icon setCaptionLabel(String)
|
||||
controlP5.Controller : Icon setColor(CColor)
|
||||
controlP5.Controller : Icon setColorActive(int)
|
||||
controlP5.Controller : Icon setColorBackground(int)
|
||||
controlP5.Controller : Icon setColorCaptionLabel(int)
|
||||
controlP5.Controller : Icon setColorForeground(int)
|
||||
controlP5.Controller : Icon setColorLabel(int)
|
||||
controlP5.Controller : Icon setColorValue(int)
|
||||
controlP5.Controller : Icon setColorValueLabel(int)
|
||||
controlP5.Controller : Icon setDecimalPrecision(int)
|
||||
controlP5.Controller : Icon setDefaultValue(float)
|
||||
controlP5.Controller : Icon setHeight(int)
|
||||
controlP5.Controller : Icon setId(int)
|
||||
controlP5.Controller : Icon setImage(PImage)
|
||||
controlP5.Controller : Icon setImage(PImage, int)
|
||||
controlP5.Controller : Icon setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Icon setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Icon setLabel(String)
|
||||
controlP5.Controller : Icon setLabelVisible(boolean)
|
||||
controlP5.Controller : Icon setLock(boolean)
|
||||
controlP5.Controller : Icon setMax(float)
|
||||
controlP5.Controller : Icon setMin(float)
|
||||
controlP5.Controller : Icon setMouseOver(boolean)
|
||||
controlP5.Controller : Icon setMoveable(boolean)
|
||||
controlP5.Controller : Icon setPosition(float, float)
|
||||
controlP5.Controller : Icon setPosition(float[])
|
||||
controlP5.Controller : Icon setSize(PImage)
|
||||
controlP5.Controller : Icon setSize(int, int)
|
||||
controlP5.Controller : Icon setStringValue(String)
|
||||
controlP5.Controller : Icon setUpdate(boolean)
|
||||
controlP5.Controller : Icon setValue(float)
|
||||
controlP5.Controller : Icon setValueLabel(String)
|
||||
controlP5.Controller : Icon setValueSelf(float)
|
||||
controlP5.Controller : Icon setView(ControllerView)
|
||||
controlP5.Controller : Icon setVisible(boolean)
|
||||
controlP5.Controller : Icon setWidth(int)
|
||||
controlP5.Controller : Icon show()
|
||||
controlP5.Controller : Icon unlock()
|
||||
controlP5.Controller : Icon unplugFrom(Object)
|
||||
controlP5.Controller : Icon unplugFrom(Object[])
|
||||
controlP5.Controller : Icon unregisterTooltip()
|
||||
controlP5.Controller : Icon update()
|
||||
controlP5.Controller : Icon updateSize()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Icon : Icon activateBy(int)
|
||||
controlP5.Icon : Icon hideBackground()
|
||||
controlP5.Icon : Icon setFill(boolean)
|
||||
controlP5.Icon : Icon setFont(PFont)
|
||||
controlP5.Icon : Icon setFont(PFont, int)
|
||||
controlP5.Icon : Icon setFontIcon(int)
|
||||
controlP5.Icon : Icon setFontIcon(int, int)
|
||||
controlP5.Icon : Icon setFontIconOff(int)
|
||||
controlP5.Icon : Icon setFontIconOn(int)
|
||||
controlP5.Icon : Icon setFontIconSize(int)
|
||||
controlP5.Icon : Icon setFontIcons(int, int)
|
||||
controlP5.Icon : Icon setFontIndex(int)
|
||||
controlP5.Icon : Icon setOff()
|
||||
controlP5.Icon : Icon setOn()
|
||||
controlP5.Icon : Icon setRoundedCorners(int)
|
||||
controlP5.Icon : Icon setScale(float, float)
|
||||
controlP5.Icon : Icon setStroke(boolean)
|
||||
controlP5.Icon : Icon setStrokeWeight(float)
|
||||
controlP5.Icon : Icon setSwitch(boolean)
|
||||
controlP5.Icon : Icon setValue(float)
|
||||
controlP5.Icon : Icon showBackground()
|
||||
controlP5.Icon : Icon update()
|
||||
controlP5.Icon : String getInfo()
|
||||
controlP5.Icon : String toString()
|
||||
controlP5.Icon : boolean getBooleanValue()
|
||||
controlP5.Icon : boolean isOn()
|
||||
controlP5.Icon : boolean isPressed()
|
||||
controlP5.Icon : boolean isSwitch()
|
||||
controlP5.Icon : int getFontIcon(int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:09
|
||||
|
||||
*/
|
||||
|
||||
|
Binary file not shown.
|
@ -0,0 +1,260 @@
|
|||
/**
|
||||
* ControlP5 Knob
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Knob Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
int knobValue = 100;
|
||||
|
||||
Knob myKnobA;
|
||||
Knob myKnobB;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
smooth();
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
myKnobA = cp5.addKnob("knob")
|
||||
.setRange(0,255)
|
||||
.setValue(50)
|
||||
.setPosition(100,70)
|
||||
.setRadius(50)
|
||||
.setDragDirection(Knob.VERTICAL)
|
||||
;
|
||||
|
||||
myKnobB = cp5.addKnob("knobValue")
|
||||
.setRange(0,255)
|
||||
.setValue(220)
|
||||
.setPosition(100,210)
|
||||
.setRadius(50)
|
||||
.setNumberOfTickMarks(10)
|
||||
.setTickMarkLength(4)
|
||||
.snapToTickMarks(true)
|
||||
.setColorForeground(color(255))
|
||||
.setColorBackground(color(0, 160, 100))
|
||||
.setColorActive(color(255,255,0))
|
||||
.setDragDirection(Knob.HORIZONTAL)
|
||||
;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(knobValue);
|
||||
rect(0,height/2,width,height/2);
|
||||
fill(0,100);
|
||||
rect(80,40,140,320);
|
||||
}
|
||||
|
||||
|
||||
void knob(int theValue) {
|
||||
myColorBackground = color(theValue);
|
||||
println("a knob event. setting background to "+theValue);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):myKnobA.setValue(180);break;
|
||||
case('2'):myKnobB.setConstrained(false).hideTickMarks().snapToTickMarks(false);break;
|
||||
case('3'):myKnobA.shuffle();myKnobB.shuffle();break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the Knob Controller
|
||||
use ControlP5.printPublicMethodsFor(Knob.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Knob in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Knob addCallback(CallbackListener)
|
||||
controlP5.Controller : Knob addListener(ControlListener)
|
||||
controlP5.Controller : Knob addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Knob align(int, int, int, int)
|
||||
controlP5.Controller : Knob bringToFront()
|
||||
controlP5.Controller : Knob bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Knob hide()
|
||||
controlP5.Controller : Knob linebreak()
|
||||
controlP5.Controller : Knob listen(boolean)
|
||||
controlP5.Controller : Knob lock()
|
||||
controlP5.Controller : Knob onChange(CallbackListener)
|
||||
controlP5.Controller : Knob onClick(CallbackListener)
|
||||
controlP5.Controller : Knob onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Knob onDrag(CallbackListener)
|
||||
controlP5.Controller : Knob onDraw(ControllerView)
|
||||
controlP5.Controller : Knob onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Knob onEnter(CallbackListener)
|
||||
controlP5.Controller : Knob onLeave(CallbackListener)
|
||||
controlP5.Controller : Knob onMove(CallbackListener)
|
||||
controlP5.Controller : Knob onPress(CallbackListener)
|
||||
controlP5.Controller : Knob onRelease(CallbackListener)
|
||||
controlP5.Controller : Knob onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Knob onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Knob onWheel(CallbackListener)
|
||||
controlP5.Controller : Knob plugTo(Object)
|
||||
controlP5.Controller : Knob plugTo(Object, String)
|
||||
controlP5.Controller : Knob plugTo(Object[])
|
||||
controlP5.Controller : Knob plugTo(Object[], String)
|
||||
controlP5.Controller : Knob registerProperty(String)
|
||||
controlP5.Controller : Knob registerProperty(String, String)
|
||||
controlP5.Controller : Knob registerTooltip(String)
|
||||
controlP5.Controller : Knob removeBehavior()
|
||||
controlP5.Controller : Knob removeCallback()
|
||||
controlP5.Controller : Knob removeCallback(CallbackListener)
|
||||
controlP5.Controller : Knob removeListener(ControlListener)
|
||||
controlP5.Controller : Knob removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Knob removeListenersFor(int)
|
||||
controlP5.Controller : Knob removeProperty(String)
|
||||
controlP5.Controller : Knob removeProperty(String, String)
|
||||
controlP5.Controller : Knob setArrayValue(float[])
|
||||
controlP5.Controller : Knob setArrayValue(int, float)
|
||||
controlP5.Controller : Knob setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Knob setBroadcast(boolean)
|
||||
controlP5.Controller : Knob setCaptionLabel(String)
|
||||
controlP5.Controller : Knob setColor(CColor)
|
||||
controlP5.Controller : Knob setColorActive(int)
|
||||
controlP5.Controller : Knob setColorBackground(int)
|
||||
controlP5.Controller : Knob setColorCaptionLabel(int)
|
||||
controlP5.Controller : Knob setColorForeground(int)
|
||||
controlP5.Controller : Knob setColorLabel(int)
|
||||
controlP5.Controller : Knob setColorValue(int)
|
||||
controlP5.Controller : Knob setColorValueLabel(int)
|
||||
controlP5.Controller : Knob setDecimalPrecision(int)
|
||||
controlP5.Controller : Knob setDefaultValue(float)
|
||||
controlP5.Controller : Knob setHeight(int)
|
||||
controlP5.Controller : Knob setId(int)
|
||||
controlP5.Controller : Knob setImage(PImage)
|
||||
controlP5.Controller : Knob setImage(PImage, int)
|
||||
controlP5.Controller : Knob setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Knob setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Knob setLabel(String)
|
||||
controlP5.Controller : Knob setLabelVisible(boolean)
|
||||
controlP5.Controller : Knob setLock(boolean)
|
||||
controlP5.Controller : Knob setMax(float)
|
||||
controlP5.Controller : Knob setMin(float)
|
||||
controlP5.Controller : Knob setMouseOver(boolean)
|
||||
controlP5.Controller : Knob setMoveable(boolean)
|
||||
controlP5.Controller : Knob setPosition(float, float)
|
||||
controlP5.Controller : Knob setPosition(float[])
|
||||
controlP5.Controller : Knob setSize(PImage)
|
||||
controlP5.Controller : Knob setSize(int, int)
|
||||
controlP5.Controller : Knob setStringValue(String)
|
||||
controlP5.Controller : Knob setUpdate(boolean)
|
||||
controlP5.Controller : Knob setValue(float)
|
||||
controlP5.Controller : Knob setValueLabel(String)
|
||||
controlP5.Controller : Knob setValueSelf(float)
|
||||
controlP5.Controller : Knob setView(ControllerView)
|
||||
controlP5.Controller : Knob setVisible(boolean)
|
||||
controlP5.Controller : Knob setWidth(int)
|
||||
controlP5.Controller : Knob show()
|
||||
controlP5.Controller : Knob unlock()
|
||||
controlP5.Controller : Knob unplugFrom(Object)
|
||||
controlP5.Controller : Knob unplugFrom(Object[])
|
||||
controlP5.Controller : Knob unregisterTooltip()
|
||||
controlP5.Controller : Knob update()
|
||||
controlP5.Controller : Knob updateSize()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Knob : Knob hideTickMarks()
|
||||
controlP5.Knob : Knob setAngleRange(float)
|
||||
controlP5.Knob : Knob setConstrained(boolean)
|
||||
controlP5.Knob : Knob setDragDirection(int)
|
||||
controlP5.Knob : Knob setMax(float)
|
||||
controlP5.Knob : Knob setMin(float)
|
||||
controlP5.Knob : Knob setNumberOfTickMarks(int)
|
||||
controlP5.Knob : Knob setRadius(float)
|
||||
controlP5.Knob : Knob setRange(float, float)
|
||||
controlP5.Knob : Knob setResolution(float)
|
||||
controlP5.Knob : Knob setScrollSensitivity(float)
|
||||
controlP5.Knob : Knob setShowAngleRange(boolean)
|
||||
controlP5.Knob : Knob setSize(int, int)
|
||||
controlP5.Knob : Knob setStartAngle(float)
|
||||
controlP5.Knob : Knob setTickMarkLength(int)
|
||||
controlP5.Knob : Knob setTickMarkWeight(float)
|
||||
controlP5.Knob : Knob setValue(float)
|
||||
controlP5.Knob : Knob setViewStyle(int)
|
||||
controlP5.Knob : Knob showTickMarks()
|
||||
controlP5.Knob : Knob shuffle()
|
||||
controlP5.Knob : Knob snapToTickMarks(boolean)
|
||||
controlP5.Knob : boolean isConstrained()
|
||||
controlP5.Knob : boolean isShowAngleRange()
|
||||
controlP5.Knob : boolean isShowTickMarks()
|
||||
controlP5.Knob : float getAngle()
|
||||
controlP5.Knob : float getAngleRange()
|
||||
controlP5.Knob : float getRadius()
|
||||
controlP5.Knob : float getResolution()
|
||||
controlP5.Knob : float getStartAngle()
|
||||
controlP5.Knob : float getTickMarkWeight()
|
||||
controlP5.Knob : float getValue()
|
||||
controlP5.Knob : int getDragDirection()
|
||||
controlP5.Knob : int getNumberOfTickMarks()
|
||||
controlP5.Knob : int getTickMarkLength()
|
||||
controlP5.Knob : int getViewStyle()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:10
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,319 @@
|
|||
/**
|
||||
*
|
||||
* DEPRECATED, use ScrollableList instead.
|
||||
*
|
||||
* ControlP5 ListBox
|
||||
*
|
||||
* find a list of public methods available for the ListBox Controller
|
||||
* at the bottom of this sketch.
|
||||
* use the scrollwheel, up or down cursors to scroll through
|
||||
* a listbox when hovering with the mouse.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
ListBox l;
|
||||
|
||||
int cnt = 0;
|
||||
|
||||
void setup() {
|
||||
|
||||
size(700, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// ListBox is DEPRECATED,
|
||||
// use ScrollableList instead,
|
||||
// see example ControlP5scrollableList
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
l = cp5.addListBox("myList")
|
||||
.setPosition(100, 100)
|
||||
.setSize(120, 120)
|
||||
.setItemHeight(15)
|
||||
.setBarHeight(15)
|
||||
.setColorBackground(color(255, 128))
|
||||
.setColorActive(color(0))
|
||||
.setColorForeground(color(255, 100,0))
|
||||
;
|
||||
|
||||
l.getCaptionLabel().toUpperCase(true);
|
||||
l.getCaptionLabel().set("A Listbox");
|
||||
l.getCaptionLabel().setColor(0xffff0000);
|
||||
for (int i=0;i<80;i++) {
|
||||
l.addItem("item "+i, i);
|
||||
l.getItem("item "+i).put("color", new CColor().setBackground(0xffff0000).setBackground(0xffff8800));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
if (key=='0') {
|
||||
// will activate the listbox item with value 5
|
||||
l.setValue(5);
|
||||
}
|
||||
if (key=='1') {
|
||||
// set the height of a listBox should always be a multiple of itemHeight
|
||||
l.setHeight(210);
|
||||
}
|
||||
else if (key=='2') {
|
||||
// set the height of a listBox should always be a multiple of itemHeight
|
||||
l.setHeight(120);
|
||||
}
|
||||
else if (key=='3') {
|
||||
// set the width of a listBox
|
||||
l.setWidth(200);
|
||||
}
|
||||
else if (key=='i') {
|
||||
// set the height of a listBoxItem, should always be a fraction of the listBox
|
||||
l.setItemHeight(30);
|
||||
}
|
||||
else if (key=='u') {
|
||||
// set the height of a listBoxItem, should always be a fraction of the listBox
|
||||
l.setItemHeight(10);
|
||||
l.setBackgroundColor(color(100, 0, 0));
|
||||
}
|
||||
else if (key=='a') {
|
||||
int n = (int)(random(100000));
|
||||
l.addItem("item "+n, n);
|
||||
}
|
||||
else if (key=='d') {
|
||||
l.removeItem("item "+cnt);
|
||||
cnt++;
|
||||
} else if (key=='c') {
|
||||
l.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
// ListBox is if type ControlGroup.
|
||||
// 1 controlEvent will be executed, where the event
|
||||
// originates from a ControlGroup. therefore
|
||||
// you need to check the Event with
|
||||
// if (theEvent.isGroup())
|
||||
// to avoid an error message from controlP5.
|
||||
|
||||
if (theEvent.isGroup()) {
|
||||
// an event from a group e.g. scrollList
|
||||
println(theEvent.getGroup().getValue()+" from "+theEvent.getGroup());
|
||||
}
|
||||
|
||||
if(theEvent.isGroup() && theEvent.getName().equals("myList")){
|
||||
int test = (int)theEvent.getGroup().getValue();
|
||||
println("test "+test);
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(128);
|
||||
// scroll the scroll List according to the mouseX position
|
||||
// when holding down SPACE.
|
||||
if (keyPressed && key==' ') {
|
||||
//l.scroll(mouseX/((float)width)); // scroll taks values between 0 and 1
|
||||
}
|
||||
if (keyPressed && key==' ') {
|
||||
l.setWidth(mouseX);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ListBox Controller
|
||||
use ControlP5.printPublicMethodsFor(ListBox.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ListBox in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : ListBox addCallback(CallbackListener)
|
||||
controlP5.Controller : ListBox addListener(ControlListener)
|
||||
controlP5.Controller : ListBox addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ListBox align(int, int, int, int)
|
||||
controlP5.Controller : ListBox bringToFront()
|
||||
controlP5.Controller : ListBox bringToFront(ControllerInterface)
|
||||
controlP5.Controller : ListBox hide()
|
||||
controlP5.Controller : ListBox linebreak()
|
||||
controlP5.Controller : ListBox listen(boolean)
|
||||
controlP5.Controller : ListBox lock()
|
||||
controlP5.Controller : ListBox onChange(CallbackListener)
|
||||
controlP5.Controller : ListBox onClick(CallbackListener)
|
||||
controlP5.Controller : ListBox onDoublePress(CallbackListener)
|
||||
controlP5.Controller : ListBox onDrag(CallbackListener)
|
||||
controlP5.Controller : ListBox onDraw(ControllerView)
|
||||
controlP5.Controller : ListBox onEndDrag(CallbackListener)
|
||||
controlP5.Controller : ListBox onEnter(CallbackListener)
|
||||
controlP5.Controller : ListBox onLeave(CallbackListener)
|
||||
controlP5.Controller : ListBox onMove(CallbackListener)
|
||||
controlP5.Controller : ListBox onPress(CallbackListener)
|
||||
controlP5.Controller : ListBox onRelease(CallbackListener)
|
||||
controlP5.Controller : ListBox onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : ListBox onStartDrag(CallbackListener)
|
||||
controlP5.Controller : ListBox onWheel(CallbackListener)
|
||||
controlP5.Controller : ListBox plugTo(Object)
|
||||
controlP5.Controller : ListBox plugTo(Object, String)
|
||||
controlP5.Controller : ListBox plugTo(Object[])
|
||||
controlP5.Controller : ListBox plugTo(Object[], String)
|
||||
controlP5.Controller : ListBox registerProperty(String)
|
||||
controlP5.Controller : ListBox registerProperty(String, String)
|
||||
controlP5.Controller : ListBox registerTooltip(String)
|
||||
controlP5.Controller : ListBox removeBehavior()
|
||||
controlP5.Controller : ListBox removeCallback()
|
||||
controlP5.Controller : ListBox removeCallback(CallbackListener)
|
||||
controlP5.Controller : ListBox removeListener(ControlListener)
|
||||
controlP5.Controller : ListBox removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ListBox removeListenersFor(int)
|
||||
controlP5.Controller : ListBox removeProperty(String)
|
||||
controlP5.Controller : ListBox removeProperty(String, String)
|
||||
controlP5.Controller : ListBox setArrayValue(float[])
|
||||
controlP5.Controller : ListBox setArrayValue(int, float)
|
||||
controlP5.Controller : ListBox setBehavior(ControlBehavior)
|
||||
controlP5.Controller : ListBox setBroadcast(boolean)
|
||||
controlP5.Controller : ListBox setCaptionLabel(String)
|
||||
controlP5.Controller : ListBox setColor(CColor)
|
||||
controlP5.Controller : ListBox setColorActive(int)
|
||||
controlP5.Controller : ListBox setColorBackground(int)
|
||||
controlP5.Controller : ListBox setColorCaptionLabel(int)
|
||||
controlP5.Controller : ListBox setColorForeground(int)
|
||||
controlP5.Controller : ListBox setColorLabel(int)
|
||||
controlP5.Controller : ListBox setColorValue(int)
|
||||
controlP5.Controller : ListBox setColorValueLabel(int)
|
||||
controlP5.Controller : ListBox setDecimalPrecision(int)
|
||||
controlP5.Controller : ListBox setDefaultValue(float)
|
||||
controlP5.Controller : ListBox setHeight(int)
|
||||
controlP5.Controller : ListBox setId(int)
|
||||
controlP5.Controller : ListBox setImage(PImage)
|
||||
controlP5.Controller : ListBox setImage(PImage, int)
|
||||
controlP5.Controller : ListBox setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : ListBox setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : ListBox setLabel(String)
|
||||
controlP5.Controller : ListBox setLabelVisible(boolean)
|
||||
controlP5.Controller : ListBox setLock(boolean)
|
||||
controlP5.Controller : ListBox setMax(float)
|
||||
controlP5.Controller : ListBox setMin(float)
|
||||
controlP5.Controller : ListBox setMouseOver(boolean)
|
||||
controlP5.Controller : ListBox setMoveable(boolean)
|
||||
controlP5.Controller : ListBox setPosition(float, float)
|
||||
controlP5.Controller : ListBox setPosition(float[])
|
||||
controlP5.Controller : ListBox setSize(PImage)
|
||||
controlP5.Controller : ListBox setSize(int, int)
|
||||
controlP5.Controller : ListBox setStringValue(String)
|
||||
controlP5.Controller : ListBox setUpdate(boolean)
|
||||
controlP5.Controller : ListBox setValue(float)
|
||||
controlP5.Controller : ListBox setValueLabel(String)
|
||||
controlP5.Controller : ListBox setValueSelf(float)
|
||||
controlP5.Controller : ListBox setView(ControllerView)
|
||||
controlP5.Controller : ListBox setVisible(boolean)
|
||||
controlP5.Controller : ListBox setWidth(int)
|
||||
controlP5.Controller : ListBox show()
|
||||
controlP5.Controller : ListBox unlock()
|
||||
controlP5.Controller : ListBox unplugFrom(Object)
|
||||
controlP5.Controller : ListBox unplugFrom(Object[])
|
||||
controlP5.Controller : ListBox unregisterTooltip()
|
||||
controlP5.Controller : ListBox update()
|
||||
controlP5.Controller : ListBox updateSize()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.ListBox : List getItems()
|
||||
controlP5.ListBox : ListBox addItem(String, Object)
|
||||
controlP5.ListBox : ListBox addItems(List)
|
||||
controlP5.ListBox : ListBox addItems(Map)
|
||||
controlP5.ListBox : ListBox addItems(String[])
|
||||
controlP5.ListBox : ListBox clear()
|
||||
controlP5.ListBox : ListBox close()
|
||||
controlP5.ListBox : ListBox open()
|
||||
controlP5.ListBox : ListBox removeItem(String)
|
||||
controlP5.ListBox : ListBox removeItems(List)
|
||||
controlP5.ListBox : ListBox setBackgroundColor(int)
|
||||
controlP5.ListBox : ListBox setBarHeight(int)
|
||||
controlP5.ListBox : ListBox setBarVisible(boolean)
|
||||
controlP5.ListBox : ListBox setItemHeight(int)
|
||||
controlP5.ListBox : ListBox setItems(List)
|
||||
controlP5.ListBox : ListBox setItems(Map)
|
||||
controlP5.ListBox : ListBox setItems(String[])
|
||||
controlP5.ListBox : ListBox setOpen(boolean)
|
||||
controlP5.ListBox : ListBox setScrollSensitivity(float)
|
||||
controlP5.ListBox : ListBox setType(int)
|
||||
controlP5.ListBox : Map getItem(String)
|
||||
controlP5.ListBox : Map getItem(int)
|
||||
controlP5.ListBox : boolean isBarVisible()
|
||||
controlP5.ListBox : boolean isOpen()
|
||||
controlP5.ListBox : int getBackgroundColor()
|
||||
controlP5.ListBox : int getBarHeight()
|
||||
controlP5.ListBox : int getHeight()
|
||||
controlP5.ListBox : void controlEvent(ControlEvent)
|
||||
controlP5.ListBox : void keyEvent(KeyEvent)
|
||||
controlP5.ListBox : void setDirection(int)
|
||||
controlP5.ListBox : void updateItemIndexOffset()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:12
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
/**
|
||||
* ControlP5 Matrix
|
||||
*
|
||||
* A matrix can be used for example as a sequencer, a drum machine.
|
||||
*
|
||||
* find a list of public methods available for the Matrix Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Dong[][] d;
|
||||
int nx = 10;
|
||||
int ny = 10;
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addMatrix("myMatrix")
|
||||
.setPosition(50, 100)
|
||||
.setSize(200, 200)
|
||||
.setGrid(nx, ny)
|
||||
.setGap(10, 1)
|
||||
.setInterval(200)
|
||||
.setMode(ControlP5.MULTIPLES)
|
||||
.setColorBackground(color(120))
|
||||
.setBackground(color(40))
|
||||
;
|
||||
|
||||
cp5.getController("myMatrix").getCaptionLabel().alignX(CENTER);
|
||||
|
||||
// use setMode to change the cell-activation which by
|
||||
// default is ControlP5.SINGLE_ROW, 1 active cell per row,
|
||||
// but can be changed to ControlP5.SINGLE_COLUMN or
|
||||
// ControlP5.MULTIPLES
|
||||
|
||||
d = new Dong[nx][ny];
|
||||
for (int x = 0;x<nx;x++) {
|
||||
for (int y = 0;y<ny;y++) {
|
||||
d[x][y] = new Dong();
|
||||
}
|
||||
}
|
||||
noStroke();
|
||||
smooth();
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
fill(255, 100);
|
||||
pushMatrix();
|
||||
translate(width/2 + 150, height/2);
|
||||
rotate(frameCount*0.001);
|
||||
for (int x = 0;x<nx;x++) {
|
||||
for (int y = 0;y<ny;y++) {
|
||||
d[x][y].display();
|
||||
}
|
||||
}
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
|
||||
void myMatrix(int theX, int theY) {
|
||||
println("got it: "+theX+", "+theY);
|
||||
d[theX][theY].update();
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
if (key=='1') {
|
||||
cp5.get(Matrix.class, "myMatrix").set(0, 0, true);
|
||||
}
|
||||
else if (key=='2') {
|
||||
cp5.get(Matrix.class, "myMatrix").set(0, 1, true);
|
||||
}
|
||||
else if (key=='3') {
|
||||
cp5.get(Matrix.class, "myMatrix").trigger(0);
|
||||
}
|
||||
else if (key=='p') {
|
||||
if (cp5.get(Matrix.class, "myMatrix").isPlaying()) {
|
||||
cp5.get(Matrix.class, "myMatrix").pause();
|
||||
}
|
||||
else {
|
||||
cp5.get(Matrix.class, "myMatrix").play();
|
||||
}
|
||||
}
|
||||
else if (key=='0') {
|
||||
cp5.get(Matrix.class, "myMatrix").clear();
|
||||
}
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
}
|
||||
|
||||
|
||||
class Dong {
|
||||
float x, y;
|
||||
float s0, s1;
|
||||
|
||||
Dong() {
|
||||
float f= random(-PI, PI);
|
||||
x = cos(f)*random(100, 150);
|
||||
y = sin(f)*random(100, 150);
|
||||
s0 = random(2, 10);
|
||||
}
|
||||
|
||||
void display() {
|
||||
s1 += (s0-s1)*0.1;
|
||||
ellipse(x, y, s1, s1);
|
||||
}
|
||||
|
||||
void update() {
|
||||
s1 = 50;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Matrix Controller
|
||||
use ControlP5.printPublicMethodsFor(Matrix.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Matrix in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Matrix addCallback(CallbackListener)
|
||||
controlP5.Controller : Matrix addListener(ControlListener)
|
||||
controlP5.Controller : Matrix addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Matrix align(int, int, int, int)
|
||||
controlP5.Controller : Matrix bringToFront()
|
||||
controlP5.Controller : Matrix bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Matrix hide()
|
||||
controlP5.Controller : Matrix linebreak()
|
||||
controlP5.Controller : Matrix listen(boolean)
|
||||
controlP5.Controller : Matrix lock()
|
||||
controlP5.Controller : Matrix onChange(CallbackListener)
|
||||
controlP5.Controller : Matrix onClick(CallbackListener)
|
||||
controlP5.Controller : Matrix onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Matrix onDrag(CallbackListener)
|
||||
controlP5.Controller : Matrix onDraw(ControllerView)
|
||||
controlP5.Controller : Matrix onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Matrix onEnter(CallbackListener)
|
||||
controlP5.Controller : Matrix onLeave(CallbackListener)
|
||||
controlP5.Controller : Matrix onMove(CallbackListener)
|
||||
controlP5.Controller : Matrix onPress(CallbackListener)
|
||||
controlP5.Controller : Matrix onRelease(CallbackListener)
|
||||
controlP5.Controller : Matrix onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Matrix onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Matrix onWheel(CallbackListener)
|
||||
controlP5.Controller : Matrix plugTo(Object)
|
||||
controlP5.Controller : Matrix plugTo(Object, String)
|
||||
controlP5.Controller : Matrix plugTo(Object[])
|
||||
controlP5.Controller : Matrix plugTo(Object[], String)
|
||||
controlP5.Controller : Matrix registerProperty(String)
|
||||
controlP5.Controller : Matrix registerProperty(String, String)
|
||||
controlP5.Controller : Matrix registerTooltip(String)
|
||||
controlP5.Controller : Matrix removeBehavior()
|
||||
controlP5.Controller : Matrix removeCallback()
|
||||
controlP5.Controller : Matrix removeCallback(CallbackListener)
|
||||
controlP5.Controller : Matrix removeListener(ControlListener)
|
||||
controlP5.Controller : Matrix removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Matrix removeListenersFor(int)
|
||||
controlP5.Controller : Matrix removeProperty(String)
|
||||
controlP5.Controller : Matrix removeProperty(String, String)
|
||||
controlP5.Controller : Matrix setArrayValue(float[])
|
||||
controlP5.Controller : Matrix setArrayValue(int, float)
|
||||
controlP5.Controller : Matrix setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Matrix setBroadcast(boolean)
|
||||
controlP5.Controller : Matrix setCaptionLabel(String)
|
||||
controlP5.Controller : Matrix setColor(CColor)
|
||||
controlP5.Controller : Matrix setColorActive(int)
|
||||
controlP5.Controller : Matrix setColorBackground(int)
|
||||
controlP5.Controller : Matrix setColorCaptionLabel(int)
|
||||
controlP5.Controller : Matrix setColorForeground(int)
|
||||
controlP5.Controller : Matrix setColorLabel(int)
|
||||
controlP5.Controller : Matrix setColorValue(int)
|
||||
controlP5.Controller : Matrix setColorValueLabel(int)
|
||||
controlP5.Controller : Matrix setDecimalPrecision(int)
|
||||
controlP5.Controller : Matrix setDefaultValue(float)
|
||||
controlP5.Controller : Matrix setHeight(int)
|
||||
controlP5.Controller : Matrix setId(int)
|
||||
controlP5.Controller : Matrix setImage(PImage)
|
||||
controlP5.Controller : Matrix setImage(PImage, int)
|
||||
controlP5.Controller : Matrix setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Matrix setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Matrix setLabel(String)
|
||||
controlP5.Controller : Matrix setLabelVisible(boolean)
|
||||
controlP5.Controller : Matrix setLock(boolean)
|
||||
controlP5.Controller : Matrix setMax(float)
|
||||
controlP5.Controller : Matrix setMin(float)
|
||||
controlP5.Controller : Matrix setMouseOver(boolean)
|
||||
controlP5.Controller : Matrix setMoveable(boolean)
|
||||
controlP5.Controller : Matrix setPosition(float, float)
|
||||
controlP5.Controller : Matrix setPosition(float[])
|
||||
controlP5.Controller : Matrix setSize(PImage)
|
||||
controlP5.Controller : Matrix setSize(int, int)
|
||||
controlP5.Controller : Matrix setStringValue(String)
|
||||
controlP5.Controller : Matrix setUpdate(boolean)
|
||||
controlP5.Controller : Matrix setValue(float)
|
||||
controlP5.Controller : Matrix setValueLabel(String)
|
||||
controlP5.Controller : Matrix setValueSelf(float)
|
||||
controlP5.Controller : Matrix setView(ControllerView)
|
||||
controlP5.Controller : Matrix setVisible(boolean)
|
||||
controlP5.Controller : Matrix setWidth(int)
|
||||
controlP5.Controller : Matrix show()
|
||||
controlP5.Controller : Matrix unlock()
|
||||
controlP5.Controller : Matrix unplugFrom(Object)
|
||||
controlP5.Controller : Matrix unplugFrom(Object[])
|
||||
controlP5.Controller : Matrix unregisterTooltip()
|
||||
controlP5.Controller : Matrix update()
|
||||
controlP5.Controller : Matrix updateSize()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Matrix : Matrix clear()
|
||||
controlP5.Matrix : Matrix pause()
|
||||
controlP5.Matrix : Matrix play()
|
||||
controlP5.Matrix : Matrix plugTo(Object)
|
||||
controlP5.Matrix : Matrix plugTo(Object, String)
|
||||
controlP5.Matrix : Matrix set(int, int, boolean)
|
||||
controlP5.Matrix : Matrix setBackground(int)
|
||||
controlP5.Matrix : Matrix setCells(int[][])
|
||||
controlP5.Matrix : Matrix setGap(int, int)
|
||||
controlP5.Matrix : Matrix setGrid(int, int)
|
||||
controlP5.Matrix : Matrix setInterval(int)
|
||||
controlP5.Matrix : Matrix setMode(int)
|
||||
controlP5.Matrix : Matrix setValue(float)
|
||||
controlP5.Matrix : Matrix stop()
|
||||
controlP5.Matrix : Matrix trigger(int)
|
||||
controlP5.Matrix : Matrix update()
|
||||
controlP5.Matrix : boolean get(int, int)
|
||||
controlP5.Matrix : boolean isPlaying()
|
||||
controlP5.Matrix : int getInterval()
|
||||
controlP5.Matrix : int getMode()
|
||||
controlP5.Matrix : int[][] getCells()
|
||||
controlP5.Matrix : void remove()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:14
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* ControlP5 MultiList
|
||||
* by andreas schlegel, 2009
|
||||
*
|
||||
* broken with version 2.2.1+
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 controlP5;
|
||||
MultiList l;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
frameRate(30);
|
||||
controlP5 = new ControlP5(this);
|
||||
|
||||
// sorry, MultiList is currently broken.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// add a multiList to controlP5.
|
||||
// elements of the list have default dimensions
|
||||
// here, a width of 100 and a height of 12
|
||||
l = controlP5.addMultiList("myList",20,20,100,12);
|
||||
|
||||
// create a multiListButton which we will use to
|
||||
// add new buttons to the multilist
|
||||
MultiListButton b;
|
||||
b = l.add("level1",1);
|
||||
|
||||
// add items to a sublist of button "level1"
|
||||
b.add("level11",11).setLabel("level1 item1");
|
||||
b.add("level12",12).setLabel("level1 item2");
|
||||
|
||||
b = l.add("level2",2);
|
||||
|
||||
int cnt = 100;
|
||||
|
||||
// add some more sublists.
|
||||
for(int i=0;i<10;i++) {
|
||||
MultiListButton c = b.add("level2"+(i+1),20+i+1);
|
||||
c.setLabel("level2 item"+(i+1));
|
||||
c.setColorBackground(color(64 + 18*i,0,0));
|
||||
|
||||
if(i==4) {
|
||||
// changing the width and the height of a button
|
||||
// will be inherited by its sublists.
|
||||
c.setWidth(100);
|
||||
c.setHeight(20);
|
||||
}
|
||||
cnt++;
|
||||
|
||||
if(i==4) {
|
||||
for(int j=0;j<10;j++) {
|
||||
cnt++;
|
||||
MultiListButton d;
|
||||
d = c.add("level2"+i+""+j,250+j+1);
|
||||
d.setLabel("level2 item"+(i+1)+" "+"item"+(j+1));
|
||||
d.setColorBackground(color(64 + 18*j,(64 + 18*j)/2,0));
|
||||
d.setId(cnt);
|
||||
d.setWidth(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MultiListButton cc = (MultiListButton)controlP5.getController("level21");
|
||||
cc.setHeight(40);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
println(theEvent.getController().getName()+" = "+theEvent.value());
|
||||
// uncomment the line below to remove a multilist item when clicked.
|
||||
// theEvent.controller().remove();
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
if(controlP5.getController("level23")!=null) {
|
||||
println("removing multilist button level23.");
|
||||
controlP5.getController("level23").remove();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
/**
|
||||
* ControlP5 Numberbox
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Numberbox Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
|
||||
public float numberboxValue = 100;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addNumberbox("numberbox")
|
||||
.setPosition(100,160)
|
||||
.setSize(100,20)
|
||||
.setScrollSensitivity(1.1)
|
||||
.setValue(50)
|
||||
;
|
||||
|
||||
|
||||
cp5.addNumberbox("numberboxValue")
|
||||
.setPosition(100,220)
|
||||
.setSize(100,20)
|
||||
.setRange(0,200)
|
||||
.setMultiplier(0.1) // set the sensitifity of the numberbox
|
||||
.setDirection(Controller.HORIZONTAL) // change the control direction to left/right
|
||||
.setValue(100)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(numberboxValue);
|
||||
rect(0,0,width,100);
|
||||
}
|
||||
|
||||
void numberbox(int theColor) {
|
||||
myColorBackground = color(theColor);
|
||||
println("a numberbox event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Numberbox Controller
|
||||
use ControlP5.printPublicMethodsFor(Numberbox.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Numberbox in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Numberbox addCallback(CallbackListener)
|
||||
controlP5.Controller : Numberbox addListener(ControlListener)
|
||||
controlP5.Controller : Numberbox addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Numberbox align(int, int, int, int)
|
||||
controlP5.Controller : Numberbox bringToFront()
|
||||
controlP5.Controller : Numberbox bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Numberbox hide()
|
||||
controlP5.Controller : Numberbox linebreak()
|
||||
controlP5.Controller : Numberbox listen(boolean)
|
||||
controlP5.Controller : Numberbox lock()
|
||||
controlP5.Controller : Numberbox onChange(CallbackListener)
|
||||
controlP5.Controller : Numberbox onClick(CallbackListener)
|
||||
controlP5.Controller : Numberbox onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Numberbox onDrag(CallbackListener)
|
||||
controlP5.Controller : Numberbox onDraw(ControllerView)
|
||||
controlP5.Controller : Numberbox onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Numberbox onEnter(CallbackListener)
|
||||
controlP5.Controller : Numberbox onLeave(CallbackListener)
|
||||
controlP5.Controller : Numberbox onMove(CallbackListener)
|
||||
controlP5.Controller : Numberbox onPress(CallbackListener)
|
||||
controlP5.Controller : Numberbox onRelease(CallbackListener)
|
||||
controlP5.Controller : Numberbox onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Numberbox onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Numberbox onWheel(CallbackListener)
|
||||
controlP5.Controller : Numberbox plugTo(Object)
|
||||
controlP5.Controller : Numberbox plugTo(Object, String)
|
||||
controlP5.Controller : Numberbox plugTo(Object[])
|
||||
controlP5.Controller : Numberbox plugTo(Object[], String)
|
||||
controlP5.Controller : Numberbox registerProperty(String)
|
||||
controlP5.Controller : Numberbox registerProperty(String, String)
|
||||
controlP5.Controller : Numberbox registerTooltip(String)
|
||||
controlP5.Controller : Numberbox removeBehavior()
|
||||
controlP5.Controller : Numberbox removeCallback()
|
||||
controlP5.Controller : Numberbox removeCallback(CallbackListener)
|
||||
controlP5.Controller : Numberbox removeListener(ControlListener)
|
||||
controlP5.Controller : Numberbox removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Numberbox removeListenersFor(int)
|
||||
controlP5.Controller : Numberbox removeProperty(String)
|
||||
controlP5.Controller : Numberbox removeProperty(String, String)
|
||||
controlP5.Controller : Numberbox setArrayValue(float[])
|
||||
controlP5.Controller : Numberbox setArrayValue(int, float)
|
||||
controlP5.Controller : Numberbox setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Numberbox setBroadcast(boolean)
|
||||
controlP5.Controller : Numberbox setCaptionLabel(String)
|
||||
controlP5.Controller : Numberbox setColor(CColor)
|
||||
controlP5.Controller : Numberbox setColorActive(int)
|
||||
controlP5.Controller : Numberbox setColorBackground(int)
|
||||
controlP5.Controller : Numberbox setColorCaptionLabel(int)
|
||||
controlP5.Controller : Numberbox setColorForeground(int)
|
||||
controlP5.Controller : Numberbox setColorLabel(int)
|
||||
controlP5.Controller : Numberbox setColorValue(int)
|
||||
controlP5.Controller : Numberbox setColorValueLabel(int)
|
||||
controlP5.Controller : Numberbox setDecimalPrecision(int)
|
||||
controlP5.Controller : Numberbox setDefaultValue(float)
|
||||
controlP5.Controller : Numberbox setHeight(int)
|
||||
controlP5.Controller : Numberbox setId(int)
|
||||
controlP5.Controller : Numberbox setImage(PImage)
|
||||
controlP5.Controller : Numberbox setImage(PImage, int)
|
||||
controlP5.Controller : Numberbox setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Numberbox setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Numberbox setLabel(String)
|
||||
controlP5.Controller : Numberbox setLabelVisible(boolean)
|
||||
controlP5.Controller : Numberbox setLock(boolean)
|
||||
controlP5.Controller : Numberbox setMax(float)
|
||||
controlP5.Controller : Numberbox setMin(float)
|
||||
controlP5.Controller : Numberbox setMouseOver(boolean)
|
||||
controlP5.Controller : Numberbox setMoveable(boolean)
|
||||
controlP5.Controller : Numberbox setPosition(float, float)
|
||||
controlP5.Controller : Numberbox setPosition(float[])
|
||||
controlP5.Controller : Numberbox setSize(PImage)
|
||||
controlP5.Controller : Numberbox setSize(int, int)
|
||||
controlP5.Controller : Numberbox setStringValue(String)
|
||||
controlP5.Controller : Numberbox setUpdate(boolean)
|
||||
controlP5.Controller : Numberbox setValue(float)
|
||||
controlP5.Controller : Numberbox setValueLabel(String)
|
||||
controlP5.Controller : Numberbox setValueSelf(float)
|
||||
controlP5.Controller : Numberbox setView(ControllerView)
|
||||
controlP5.Controller : Numberbox setVisible(boolean)
|
||||
controlP5.Controller : Numberbox setWidth(int)
|
||||
controlP5.Controller : Numberbox show()
|
||||
controlP5.Controller : Numberbox unlock()
|
||||
controlP5.Controller : Numberbox unplugFrom(Object)
|
||||
controlP5.Controller : Numberbox unplugFrom(Object[])
|
||||
controlP5.Controller : Numberbox unregisterTooltip()
|
||||
controlP5.Controller : Numberbox update()
|
||||
controlP5.Controller : Numberbox updateSize()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Numberbox : Numberbox linebreak()
|
||||
controlP5.Numberbox : Numberbox setDirection(int)
|
||||
controlP5.Numberbox : Numberbox setMultiplier(float)
|
||||
controlP5.Numberbox : Numberbox setRange(float, float)
|
||||
controlP5.Numberbox : Numberbox setScrollSensitivity(float)
|
||||
controlP5.Numberbox : Numberbox setValue(float)
|
||||
controlP5.Numberbox : Numberbox shuffle()
|
||||
controlP5.Numberbox : Numberbox update()
|
||||
controlP5.Numberbox : float getMultiplier()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:44
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* ControlP5 RadioButton
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the RadioButton Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
|
||||
RadioButton r1, r2;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
r1 = cp5.addRadioButton("radioButton")
|
||||
.setPosition(100,180)
|
||||
.setSize(40,20)
|
||||
.setColorForeground(color(120))
|
||||
.setColorActive(color(255))
|
||||
.setColorLabel(color(255))
|
||||
.setItemsPerRow(5)
|
||||
.setSpacingColumn(50)
|
||||
.addItem("50",1)
|
||||
.addItem("100",2)
|
||||
.addItem("150",3)
|
||||
.addItem("200",4)
|
||||
.addItem("250",5)
|
||||
;
|
||||
|
||||
for(Toggle t:r1.getItems()) {
|
||||
t.getCaptionLabel().setColorBackground(color(255,80));
|
||||
t.getCaptionLabel().getStyle().moveMargin(-7,0,0,-3);
|
||||
t.getCaptionLabel().getStyle().movePadding(7,0,0,3);
|
||||
t.getCaptionLabel().getStyle().backgroundWidth = 45;
|
||||
t.getCaptionLabel().getStyle().backgroundHeight = 13;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('0'): r1.deactivateAll(); break;
|
||||
case('1'): r1.activate(0); break;
|
||||
case('2'): r1.activate(1); break;
|
||||
case('3'): r1.activate(2); break;
|
||||
case('4'): r1.activate(3); break;
|
||||
case('5'): r1.activate(4); break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if(theEvent.isFrom(r1)) {
|
||||
print("got an event from "+theEvent.getName()+"\t");
|
||||
for(int i=0;i<theEvent.getGroup().getArrayValue().length;i++) {
|
||||
print(int(theEvent.getGroup().getArrayValue()[i]));
|
||||
}
|
||||
println("\t "+theEvent.getValue());
|
||||
myColorBackground = color(int(theEvent.getGroup().getValue()*50),0,0);
|
||||
}
|
||||
}
|
||||
|
||||
void radioButton(int a) {
|
||||
println("a radio Button event: "+a);
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the RadioButton Controller
|
||||
use ControlP5.printPublicMethodsFor(RadioButton.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class RadioButton in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlGroup : RadioButton activateEvent(boolean)
|
||||
controlP5.ControlGroup : RadioButton addListener(ControlListener)
|
||||
controlP5.ControlGroup : RadioButton removeListener(ControlListener)
|
||||
controlP5.ControlGroup : RadioButton setBackgroundColor(int)
|
||||
controlP5.ControlGroup : RadioButton setBackgroundHeight(int)
|
||||
controlP5.ControlGroup : RadioButton setBarHeight(int)
|
||||
controlP5.ControlGroup : RadioButton setSize(int, int)
|
||||
controlP5.ControlGroup : RadioButton updateInternalEvents(PApplet)
|
||||
controlP5.ControlGroup : String getInfo()
|
||||
controlP5.ControlGroup : String toString()
|
||||
controlP5.ControlGroup : int getBackgroundHeight()
|
||||
controlP5.ControlGroup : int getBarHeight()
|
||||
controlP5.ControlGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : RadioButton add(ControllerInterface)
|
||||
controlP5.ControllerGroup : RadioButton addListener(ControlListener)
|
||||
controlP5.ControllerGroup : RadioButton bringToFront()
|
||||
controlP5.ControllerGroup : RadioButton bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : RadioButton close()
|
||||
controlP5.ControllerGroup : RadioButton disableCollapse()
|
||||
controlP5.ControllerGroup : RadioButton enableCollapse()
|
||||
controlP5.ControllerGroup : RadioButton hide()
|
||||
controlP5.ControllerGroup : RadioButton hideArrow()
|
||||
controlP5.ControllerGroup : RadioButton hideBar()
|
||||
controlP5.ControllerGroup : RadioButton moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : RadioButton moveTo(PApplet)
|
||||
controlP5.ControllerGroup : RadioButton open()
|
||||
controlP5.ControllerGroup : RadioButton registerProperty(String)
|
||||
controlP5.ControllerGroup : RadioButton registerProperty(String, String)
|
||||
controlP5.ControllerGroup : RadioButton remove(CDrawable)
|
||||
controlP5.ControllerGroup : RadioButton remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : RadioButton removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : RadioButton removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : RadioButton removeProperty(String)
|
||||
controlP5.ControllerGroup : RadioButton removeProperty(String, String)
|
||||
controlP5.ControllerGroup : RadioButton setAddress(String)
|
||||
controlP5.ControllerGroup : RadioButton setArrayValue(float[])
|
||||
controlP5.ControllerGroup : RadioButton setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : RadioButton setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : RadioButton setColor(CColor)
|
||||
controlP5.ControllerGroup : RadioButton setColorActive(int)
|
||||
controlP5.ControllerGroup : RadioButton setColorBackground(int)
|
||||
controlP5.ControllerGroup : RadioButton setColorForeground(int)
|
||||
controlP5.ControllerGroup : RadioButton setColorLabel(int)
|
||||
controlP5.ControllerGroup : RadioButton setColorValue(int)
|
||||
controlP5.ControllerGroup : RadioButton setHeight(int)
|
||||
controlP5.ControllerGroup : RadioButton setId(int)
|
||||
controlP5.ControllerGroup : RadioButton setLabel(String)
|
||||
controlP5.ControllerGroup : RadioButton setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : RadioButton setMoveable(boolean)
|
||||
controlP5.ControllerGroup : RadioButton setOpen(boolean)
|
||||
controlP5.ControllerGroup : RadioButton setPosition(float, float)
|
||||
controlP5.ControllerGroup : RadioButton setPosition(float[])
|
||||
controlP5.ControllerGroup : RadioButton setSize(int, int)
|
||||
controlP5.ControllerGroup : RadioButton setStringValue(String)
|
||||
controlP5.ControllerGroup : RadioButton setTitle(String)
|
||||
controlP5.ControllerGroup : RadioButton setUpdate(boolean)
|
||||
controlP5.ControllerGroup : RadioButton setValue(float)
|
||||
controlP5.ControllerGroup : RadioButton setVisible(boolean)
|
||||
controlP5.ControllerGroup : RadioButton setWidth(int)
|
||||
controlP5.ControllerGroup : RadioButton show()
|
||||
controlP5.ControllerGroup : RadioButton showArrow()
|
||||
controlP5.ControllerGroup : RadioButton showBar()
|
||||
controlP5.ControllerGroup : RadioButton update()
|
||||
controlP5.ControllerGroup : RadioButton updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
controlP5.RadioButton : List getItems()
|
||||
controlP5.RadioButton : RadioButton activate(String)
|
||||
controlP5.RadioButton : RadioButton activate(int)
|
||||
controlP5.RadioButton : RadioButton addItem(String, float)
|
||||
controlP5.RadioButton : RadioButton addItem(Toggle, float)
|
||||
controlP5.RadioButton : RadioButton align(int, int)
|
||||
controlP5.RadioButton : RadioButton align(int[])
|
||||
controlP5.RadioButton : RadioButton alignX(int)
|
||||
controlP5.RadioButton : RadioButton alignY(int)
|
||||
controlP5.RadioButton : RadioButton deactivate(String)
|
||||
controlP5.RadioButton : RadioButton deactivate(int)
|
||||
controlP5.RadioButton : RadioButton deactivateAll()
|
||||
controlP5.RadioButton : RadioButton hideLabels()
|
||||
controlP5.RadioButton : RadioButton plugTo(Object)
|
||||
controlP5.RadioButton : RadioButton plugTo(Object, String)
|
||||
controlP5.RadioButton : RadioButton removeItem(String)
|
||||
controlP5.RadioButton : RadioButton setArrayValue(float[])
|
||||
controlP5.RadioButton : RadioButton setColorLabels(int)
|
||||
controlP5.RadioButton : RadioButton setImage(PImage)
|
||||
controlP5.RadioButton : RadioButton setImage(PImage, int)
|
||||
controlP5.RadioButton : RadioButton setImages(PImage, PImage, PImage)
|
||||
controlP5.RadioButton : RadioButton setItemHeight(int)
|
||||
controlP5.RadioButton : RadioButton setItemWidth(int)
|
||||
controlP5.RadioButton : RadioButton setItemsPerRow(int)
|
||||
controlP5.RadioButton : RadioButton setLabelPadding(int, int)
|
||||
controlP5.RadioButton : RadioButton setNoneSelectedAllowed(boolean)
|
||||
controlP5.RadioButton : RadioButton setSize(PImage)
|
||||
controlP5.RadioButton : RadioButton setSize(int, int)
|
||||
controlP5.RadioButton : RadioButton setSpacingColumn(int)
|
||||
controlP5.RadioButton : RadioButton setSpacingRow(int)
|
||||
controlP5.RadioButton : RadioButton showLabels()
|
||||
controlP5.RadioButton : RadioButton toUpperCase(boolean)
|
||||
controlP5.RadioButton : RadioButton toggle(int)
|
||||
controlP5.RadioButton : String getInfo()
|
||||
controlP5.RadioButton : Toggle getItem(String)
|
||||
controlP5.RadioButton : Toggle getItem(int)
|
||||
controlP5.RadioButton : boolean getState(String)
|
||||
controlP5.RadioButton : boolean getState(int)
|
||||
controlP5.RadioButton : int[] getAlign()
|
||||
controlP5.RadioButton : void updateLayout()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:19
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,244 @@
|
|||
/**
|
||||
* ControlP5 Range
|
||||
*
|
||||
* find a list of public methods available for the Range Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
|
||||
int colorMin = 100;
|
||||
|
||||
int colorMax = 100;
|
||||
|
||||
Range range;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
cp5 = new ControlP5(this);
|
||||
range = cp5.addRange("rangeController")
|
||||
// disable broadcasting since setRange and setRangeValues will trigger an event
|
||||
.setBroadcast(false)
|
||||
.setPosition(50,50)
|
||||
.setSize(400,40)
|
||||
.setHandleSize(20)
|
||||
.setRange(0,255)
|
||||
.setRangeValues(50,100)
|
||||
// after the initialization we turn broadcast back on again
|
||||
.setBroadcast(true)
|
||||
.setColorForeground(color(255,40))
|
||||
.setColorBackground(color(255,40))
|
||||
;
|
||||
|
||||
noStroke();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(colorMax);
|
||||
fill(colorMin);
|
||||
rect(0,0,width,height/2);
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theControlEvent) {
|
||||
if(theControlEvent.isFrom("rangeController")) {
|
||||
// min and max values are stored in an array.
|
||||
// access this array with controller().arrayValue().
|
||||
// min is at index 0, max is at index 1.
|
||||
colorMin = int(theControlEvent.getController().getArrayValue(0));
|
||||
colorMax = int(theControlEvent.getController().getArrayValue(1));
|
||||
println("range update, done.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):range.setLowValue(0);break;
|
||||
case('2'):range.setLowValue(100);break;
|
||||
case('3'):range.setHighValue(120);break;
|
||||
case('4'):range.setHighValue(200);break;
|
||||
case('5'):range.setRangeValues(40,60);break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Range Controller
|
||||
use ControlP5.printPublicMethodsFor(Range.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Range in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : Range addCallback(CallbackListener)
|
||||
controlP5.Controller : Range addListener(ControlListener)
|
||||
controlP5.Controller : Range addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Range align(int, int, int, int)
|
||||
controlP5.Controller : Range bringToFront()
|
||||
controlP5.Controller : Range bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Range hide()
|
||||
controlP5.Controller : Range linebreak()
|
||||
controlP5.Controller : Range listen(boolean)
|
||||
controlP5.Controller : Range lock()
|
||||
controlP5.Controller : Range onChange(CallbackListener)
|
||||
controlP5.Controller : Range onClick(CallbackListener)
|
||||
controlP5.Controller : Range onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Range onDrag(CallbackListener)
|
||||
controlP5.Controller : Range onDraw(ControllerView)
|
||||
controlP5.Controller : Range onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Range onEnter(CallbackListener)
|
||||
controlP5.Controller : Range onLeave(CallbackListener)
|
||||
controlP5.Controller : Range onMove(CallbackListener)
|
||||
controlP5.Controller : Range onPress(CallbackListener)
|
||||
controlP5.Controller : Range onRelease(CallbackListener)
|
||||
controlP5.Controller : Range onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Range onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Range onWheel(CallbackListener)
|
||||
controlP5.Controller : Range plugTo(Object)
|
||||
controlP5.Controller : Range plugTo(Object, String)
|
||||
controlP5.Controller : Range plugTo(Object[])
|
||||
controlP5.Controller : Range plugTo(Object[], String)
|
||||
controlP5.Controller : Range registerProperty(String)
|
||||
controlP5.Controller : Range registerProperty(String, String)
|
||||
controlP5.Controller : Range registerTooltip(String)
|
||||
controlP5.Controller : Range removeBehavior()
|
||||
controlP5.Controller : Range removeCallback()
|
||||
controlP5.Controller : Range removeCallback(CallbackListener)
|
||||
controlP5.Controller : Range removeListener(ControlListener)
|
||||
controlP5.Controller : Range removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Range removeListenersFor(int)
|
||||
controlP5.Controller : Range removeProperty(String)
|
||||
controlP5.Controller : Range removeProperty(String, String)
|
||||
controlP5.Controller : Range setArrayValue(float[])
|
||||
controlP5.Controller : Range setArrayValue(int, float)
|
||||
controlP5.Controller : Range setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Range setBroadcast(boolean)
|
||||
controlP5.Controller : Range setCaptionLabel(String)
|
||||
controlP5.Controller : Range setColor(CColor)
|
||||
controlP5.Controller : Range setColorActive(int)
|
||||
controlP5.Controller : Range setColorBackground(int)
|
||||
controlP5.Controller : Range setColorCaptionLabel(int)
|
||||
controlP5.Controller : Range setColorForeground(int)
|
||||
controlP5.Controller : Range setColorLabel(int)
|
||||
controlP5.Controller : Range setColorValue(int)
|
||||
controlP5.Controller : Range setColorValueLabel(int)
|
||||
controlP5.Controller : Range setDecimalPrecision(int)
|
||||
controlP5.Controller : Range setDefaultValue(float)
|
||||
controlP5.Controller : Range setHeight(int)
|
||||
controlP5.Controller : Range setId(int)
|
||||
controlP5.Controller : Range setImage(PImage)
|
||||
controlP5.Controller : Range setImage(PImage, int)
|
||||
controlP5.Controller : Range setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Range setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Range setLabel(String)
|
||||
controlP5.Controller : Range setLabelVisible(boolean)
|
||||
controlP5.Controller : Range setLock(boolean)
|
||||
controlP5.Controller : Range setMax(float)
|
||||
controlP5.Controller : Range setMin(float)
|
||||
controlP5.Controller : Range setMouseOver(boolean)
|
||||
controlP5.Controller : Range setMoveable(boolean)
|
||||
controlP5.Controller : Range setPosition(float, float)
|
||||
controlP5.Controller : Range setPosition(float[])
|
||||
controlP5.Controller : Range setSize(PImage)
|
||||
controlP5.Controller : Range setSize(int, int)
|
||||
controlP5.Controller : Range setStringValue(String)
|
||||
controlP5.Controller : Range setUpdate(boolean)
|
||||
controlP5.Controller : Range setValue(float)
|
||||
controlP5.Controller : Range setValueLabel(String)
|
||||
controlP5.Controller : Range setValueSelf(float)
|
||||
controlP5.Controller : Range setView(ControllerView)
|
||||
controlP5.Controller : Range setVisible(boolean)
|
||||
controlP5.Controller : Range setWidth(int)
|
||||
controlP5.Controller : Range show()
|
||||
controlP5.Controller : Range unlock()
|
||||
controlP5.Controller : Range unplugFrom(Object)
|
||||
controlP5.Controller : Range unplugFrom(Object[])
|
||||
controlP5.Controller : Range unregisterTooltip()
|
||||
controlP5.Controller : Range update()
|
||||
controlP5.Controller : Range updateSize()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Range : ArrayList getTickMarks()
|
||||
controlP5.Range : Range setArrayValue(float[])
|
||||
controlP5.Range : Range setColorCaptionLabel(int)
|
||||
controlP5.Range : Range setColorTickMark(int)
|
||||
controlP5.Range : Range setColorValueLabel(int)
|
||||
controlP5.Range : Range setHandleSize(int)
|
||||
controlP5.Range : Range setHeight(int)
|
||||
controlP5.Range : Range setHighValue(float)
|
||||
controlP5.Range : Range setHighValueLabel(String)
|
||||
controlP5.Range : Range setLowValue(float)
|
||||
controlP5.Range : Range setLowValueLabel(String)
|
||||
controlP5.Range : Range setMax(float)
|
||||
controlP5.Range : Range setMin(float)
|
||||
controlP5.Range : Range setNumberOfTickMarks(int)
|
||||
controlP5.Range : Range setRange(float, float)
|
||||
controlP5.Range : Range setRangeValues(float, float)
|
||||
controlP5.Range : Range setWidth(int)
|
||||
controlP5.Range : Range showTickMarks(boolean)
|
||||
controlP5.Range : Range snapToTickMarks(boolean)
|
||||
controlP5.Range : float getHighValue()
|
||||
controlP5.Range : float getLowValue()
|
||||
controlP5.Range : float[] getArrayValue()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:20
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,261 @@
|
|||
/**
|
||||
* ControlP5 ScrollableList
|
||||
*
|
||||
* replaces DropdownList and and ListBox.
|
||||
* List can be scrolled by dragging the list or using the scroll-wheel.
|
||||
*
|
||||
* by Andreas Schlegel, 2014
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
|
||||
/* add a ScrollableList, by default it behaves like a DropdownList */
|
||||
cp5.addScrollableList("dropdown")
|
||||
.setPosition(100, 100)
|
||||
.setSize(200, 100)
|
||||
.setBarHeight(20)
|
||||
.setItemHeight(20)
|
||||
.addItems(l)
|
||||
// .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(240);
|
||||
}
|
||||
|
||||
void dropdown(int n) {
|
||||
/* request the selected item based on index n */
|
||||
println(n, cp5.get(ScrollableList.class, "dropdown").getItem(n));
|
||||
|
||||
/* here an item is stored as a Map with the following key-value pairs:
|
||||
* name, the given name of the item
|
||||
* text, the given text of the item by default the same as name
|
||||
* value, the given value of the item, can be changed by using .getItem(n).put("value", "abc"); a value here is of type Object therefore can be anything
|
||||
* color, the given color of the item, how to change, see below
|
||||
* view, a customizable view, is of type CDrawable
|
||||
*/
|
||||
|
||||
CColor c = new CColor();
|
||||
c.setBackground(color(255,0,0));
|
||||
cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
|
||||
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):
|
||||
/* make the ScrollableList behave like a ListBox */
|
||||
cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.LIST);
|
||||
break;
|
||||
case('2'):
|
||||
/* make the ScrollableList behave like a DropdownList */
|
||||
cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.DROPDOWN);
|
||||
break;
|
||||
case('3'):
|
||||
/*change content of the ScrollableList */
|
||||
List l = Arrays.asList("a-1", "b-1", "c-1", "d-1", "e-1", "f-1", "g-1", "h-1", "i-1", "j-1", "k-1");
|
||||
cp5.get(ScrollableList.class, "dropdown").setItems(l);
|
||||
break;
|
||||
case('4'):
|
||||
/* remove an item from the ScrollableList */
|
||||
cp5.get(ScrollableList.class, "dropdown").removeItem("k-1");
|
||||
break;
|
||||
case('5'):
|
||||
/* clear the ScrollableList */
|
||||
cp5.get(ScrollableList.class, "dropdown").clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
a list of all methods available for the ScrollableList Controller
|
||||
use ControlP5.printPublicMethodsFor(ScrollableList.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ScrollableList in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : ScrollableList addCallback(CallbackListener)
|
||||
controlP5.Controller : ScrollableList addListener(ControlListener)
|
||||
controlP5.Controller : ScrollableList addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ScrollableList align(int, int, int, int)
|
||||
controlP5.Controller : ScrollableList bringToFront()
|
||||
controlP5.Controller : ScrollableList bringToFront(ControllerInterface)
|
||||
controlP5.Controller : ScrollableList hide()
|
||||
controlP5.Controller : ScrollableList linebreak()
|
||||
controlP5.Controller : ScrollableList listen(boolean)
|
||||
controlP5.Controller : ScrollableList lock()
|
||||
controlP5.Controller : ScrollableList onChange(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onClick(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onDoublePress(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onDrag(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onDraw(ControllerView)
|
||||
controlP5.Controller : ScrollableList onEndDrag(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onEnter(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onLeave(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onMove(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onPress(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onRelease(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onStartDrag(CallbackListener)
|
||||
controlP5.Controller : ScrollableList onWheel(CallbackListener)
|
||||
controlP5.Controller : ScrollableList plugTo(Object)
|
||||
controlP5.Controller : ScrollableList plugTo(Object, String)
|
||||
controlP5.Controller : ScrollableList plugTo(Object[])
|
||||
controlP5.Controller : ScrollableList plugTo(Object[], String)
|
||||
controlP5.Controller : ScrollableList registerProperty(String)
|
||||
controlP5.Controller : ScrollableList registerProperty(String, String)
|
||||
controlP5.Controller : ScrollableList registerTooltip(String)
|
||||
controlP5.Controller : ScrollableList removeBehavior()
|
||||
controlP5.Controller : ScrollableList removeCallback()
|
||||
controlP5.Controller : ScrollableList removeCallback(CallbackListener)
|
||||
controlP5.Controller : ScrollableList removeListener(ControlListener)
|
||||
controlP5.Controller : ScrollableList removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : ScrollableList removeListenersFor(int)
|
||||
controlP5.Controller : ScrollableList removeProperty(String)
|
||||
controlP5.Controller : ScrollableList removeProperty(String, String)
|
||||
controlP5.Controller : ScrollableList setArrayValue(float[])
|
||||
controlP5.Controller : ScrollableList setArrayValue(int, float)
|
||||
controlP5.Controller : ScrollableList setBehavior(ControlBehavior)
|
||||
controlP5.Controller : ScrollableList setBroadcast(boolean)
|
||||
controlP5.Controller : ScrollableList setCaptionLabel(String)
|
||||
controlP5.Controller : ScrollableList setColor(CColor)
|
||||
controlP5.Controller : ScrollableList setColorActive(int)
|
||||
controlP5.Controller : ScrollableList setColorBackground(int)
|
||||
controlP5.Controller : ScrollableList setColorCaptionLabel(int)
|
||||
controlP5.Controller : ScrollableList setColorForeground(int)
|
||||
controlP5.Controller : ScrollableList setColorLabel(int)
|
||||
controlP5.Controller : ScrollableList setColorValue(int)
|
||||
controlP5.Controller : ScrollableList setColorValueLabel(int)
|
||||
controlP5.Controller : ScrollableList setDecimalPrecision(int)
|
||||
controlP5.Controller : ScrollableList setDefaultValue(float)
|
||||
controlP5.Controller : ScrollableList setHeight(int)
|
||||
controlP5.Controller : ScrollableList setId(int)
|
||||
controlP5.Controller : ScrollableList setImage(PImage)
|
||||
controlP5.Controller : ScrollableList setImage(PImage, int)
|
||||
controlP5.Controller : ScrollableList setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : ScrollableList setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : ScrollableList setLabel(String)
|
||||
controlP5.Controller : ScrollableList setLabelVisible(boolean)
|
||||
controlP5.Controller : ScrollableList setLock(boolean)
|
||||
controlP5.Controller : ScrollableList setMax(float)
|
||||
controlP5.Controller : ScrollableList setMin(float)
|
||||
controlP5.Controller : ScrollableList setMouseOver(boolean)
|
||||
controlP5.Controller : ScrollableList setMoveable(boolean)
|
||||
controlP5.Controller : ScrollableList setPosition(float, float)
|
||||
controlP5.Controller : ScrollableList setPosition(float[])
|
||||
controlP5.Controller : ScrollableList setSize(PImage)
|
||||
controlP5.Controller : ScrollableList setSize(int, int)
|
||||
controlP5.Controller : ScrollableList setStringValue(String)
|
||||
controlP5.Controller : ScrollableList setUpdate(boolean)
|
||||
controlP5.Controller : ScrollableList setValue(float)
|
||||
controlP5.Controller : ScrollableList setValueLabel(String)
|
||||
controlP5.Controller : ScrollableList setValueSelf(float)
|
||||
controlP5.Controller : ScrollableList setView(ControllerView)
|
||||
controlP5.Controller : ScrollableList setVisible(boolean)
|
||||
controlP5.Controller : ScrollableList setWidth(int)
|
||||
controlP5.Controller : ScrollableList show()
|
||||
controlP5.Controller : ScrollableList unlock()
|
||||
controlP5.Controller : ScrollableList unplugFrom(Object)
|
||||
controlP5.Controller : ScrollableList unplugFrom(Object[])
|
||||
controlP5.Controller : ScrollableList unregisterTooltip()
|
||||
controlP5.Controller : ScrollableList update()
|
||||
controlP5.Controller : ScrollableList updateSize()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.ScrollableList : List getItems()
|
||||
controlP5.ScrollableList : Map getItem(String)
|
||||
controlP5.ScrollableList : Map getItem(int)
|
||||
controlP5.ScrollableList : ScrollableList addItem(String, Object)
|
||||
controlP5.ScrollableList : ScrollableList addItems(List)
|
||||
controlP5.ScrollableList : ScrollableList addItems(Map)
|
||||
controlP5.ScrollableList : ScrollableList addItems(String[])
|
||||
controlP5.ScrollableList : ScrollableList clear()
|
||||
controlP5.ScrollableList : ScrollableList close()
|
||||
controlP5.ScrollableList : ScrollableList open()
|
||||
controlP5.ScrollableList : ScrollableList removeItem(String)
|
||||
controlP5.ScrollableList : ScrollableList removeItems(List)
|
||||
controlP5.ScrollableList : ScrollableList setBackgroundColor(int)
|
||||
controlP5.ScrollableList : ScrollableList setBarHeight(int)
|
||||
controlP5.ScrollableList : ScrollableList setBarVisible(boolean)
|
||||
controlP5.ScrollableList : ScrollableList setItemHeight(int)
|
||||
controlP5.ScrollableList : ScrollableList setItems(List)
|
||||
controlP5.ScrollableList : ScrollableList setItems(Map)
|
||||
controlP5.ScrollableList : ScrollableList setItems(String[])
|
||||
controlP5.ScrollableList : ScrollableList setOpen(boolean)
|
||||
controlP5.ScrollableList : ScrollableList setScrollSensitivity(float)
|
||||
controlP5.ScrollableList : ScrollableList setType(int)
|
||||
controlP5.ScrollableList : boolean isBarVisible()
|
||||
controlP5.ScrollableList : boolean isOpen()
|
||||
controlP5.ScrollableList : int getBackgroundColor()
|
||||
controlP5.ScrollableList : int getBarHeight()
|
||||
controlP5.ScrollableList : int getHeight()
|
||||
controlP5.ScrollableList : void controlEvent(ControlEvent)
|
||||
controlP5.ScrollableList : void keyEvent(KeyEvent)
|
||||
controlP5.ScrollableList : void setDirection(int)
|
||||
controlP5.ScrollableList : void updateItemIndexOffset()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:22
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,297 @@
|
|||
/**
|
||||
* ControlP5 Slider. Horizontal and vertical sliders,
|
||||
* with and without tick marks and snap-to-tick behavior.
|
||||
* by andreas schlegel, 2010
|
||||
*/
|
||||
|
||||
/**
|
||||
* ControlP5 Slider
|
||||
*
|
||||
* Horizontal and vertical sliders,
|
||||
* With and without tick marks and snap-to-tick behavior.
|
||||
*
|
||||
* find a list of public methods available for the Slider Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
int myColor = color(0,0,0);
|
||||
|
||||
int sliderValue = 100;
|
||||
int sliderTicks1 = 100;
|
||||
int sliderTicks2 = 30;
|
||||
Slider abc;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// add a horizontal sliders, the value of this slider will be linked
|
||||
// to variable 'sliderValue'
|
||||
cp5.addSlider("sliderValue")
|
||||
.setPosition(100,50)
|
||||
.setRange(0,255)
|
||||
;
|
||||
|
||||
// create another slider with tick marks, now without
|
||||
// default value, the initial value will be set according to
|
||||
// the value of variable sliderTicks2 then.
|
||||
cp5.addSlider("sliderTicks1")
|
||||
.setPosition(100,140)
|
||||
.setSize(20,100)
|
||||
.setRange(0,255)
|
||||
.setNumberOfTickMarks(5)
|
||||
;
|
||||
|
||||
|
||||
// add a vertical slider
|
||||
cp5.addSlider("slider")
|
||||
.setPosition(100,305)
|
||||
.setSize(200,20)
|
||||
.setRange(0,200)
|
||||
.setValue(128)
|
||||
;
|
||||
|
||||
// reposition the Label for controller 'slider'
|
||||
cp5.getController("slider").getValueLabel().align(ControlP5.LEFT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
|
||||
cp5.getController("slider").getCaptionLabel().align(ControlP5.RIGHT, ControlP5.BOTTOM_OUTSIDE).setPaddingX(0);
|
||||
|
||||
|
||||
cp5.addSlider("sliderTicks2")
|
||||
.setPosition(100,370)
|
||||
.setWidth(400)
|
||||
.setRange(255,0) // values can range from big to small as well
|
||||
.setValue(128)
|
||||
.setNumberOfTickMarks(7)
|
||||
.setSliderMode(Slider.FLEXIBLE)
|
||||
;
|
||||
// use Slider.FIX or Slider.FLEXIBLE to change the slider handle
|
||||
// by default it is Slider.FIX
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(sliderTicks1);
|
||||
|
||||
fill(sliderValue);
|
||||
rect(0,0,width,100);
|
||||
|
||||
fill(myColor);
|
||||
rect(0,280,width,70);
|
||||
|
||||
fill(sliderTicks2);
|
||||
rect(0,350,width,50);
|
||||
}
|
||||
|
||||
void slider(float theColor) {
|
||||
myColor = color(theColor);
|
||||
println("a slider event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ControlP5 Slider
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Slider Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
a list of all methods available for the Slider Controller
|
||||
use ControlP5.printPublicMethodsFor(Slider.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Slider in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : Slider addCallback(CallbackListener)
|
||||
controlP5.Controller : Slider addListener(ControlListener)
|
||||
controlP5.Controller : Slider addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Slider align(int, int, int, int)
|
||||
controlP5.Controller : Slider bringToFront()
|
||||
controlP5.Controller : Slider bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Slider hide()
|
||||
controlP5.Controller : Slider linebreak()
|
||||
controlP5.Controller : Slider listen(boolean)
|
||||
controlP5.Controller : Slider lock()
|
||||
controlP5.Controller : Slider onChange(CallbackListener)
|
||||
controlP5.Controller : Slider onClick(CallbackListener)
|
||||
controlP5.Controller : Slider onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Slider onDrag(CallbackListener)
|
||||
controlP5.Controller : Slider onDraw(ControllerView)
|
||||
controlP5.Controller : Slider onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Slider onEnter(CallbackListener)
|
||||
controlP5.Controller : Slider onLeave(CallbackListener)
|
||||
controlP5.Controller : Slider onMove(CallbackListener)
|
||||
controlP5.Controller : Slider onPress(CallbackListener)
|
||||
controlP5.Controller : Slider onRelease(CallbackListener)
|
||||
controlP5.Controller : Slider onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Slider onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Slider onWheel(CallbackListener)
|
||||
controlP5.Controller : Slider plugTo(Object)
|
||||
controlP5.Controller : Slider plugTo(Object, String)
|
||||
controlP5.Controller : Slider plugTo(Object[])
|
||||
controlP5.Controller : Slider plugTo(Object[], String)
|
||||
controlP5.Controller : Slider registerProperty(String)
|
||||
controlP5.Controller : Slider registerProperty(String, String)
|
||||
controlP5.Controller : Slider registerTooltip(String)
|
||||
controlP5.Controller : Slider removeBehavior()
|
||||
controlP5.Controller : Slider removeCallback()
|
||||
controlP5.Controller : Slider removeCallback(CallbackListener)
|
||||
controlP5.Controller : Slider removeListener(ControlListener)
|
||||
controlP5.Controller : Slider removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Slider removeListenersFor(int)
|
||||
controlP5.Controller : Slider removeProperty(String)
|
||||
controlP5.Controller : Slider removeProperty(String, String)
|
||||
controlP5.Controller : Slider setArrayValue(float[])
|
||||
controlP5.Controller : Slider setArrayValue(int, float)
|
||||
controlP5.Controller : Slider setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Slider setBroadcast(boolean)
|
||||
controlP5.Controller : Slider setCaptionLabel(String)
|
||||
controlP5.Controller : Slider setColor(CColor)
|
||||
controlP5.Controller : Slider setColorActive(int)
|
||||
controlP5.Controller : Slider setColorBackground(int)
|
||||
controlP5.Controller : Slider setColorCaptionLabel(int)
|
||||
controlP5.Controller : Slider setColorForeground(int)
|
||||
controlP5.Controller : Slider setColorLabel(int)
|
||||
controlP5.Controller : Slider setColorValue(int)
|
||||
controlP5.Controller : Slider setColorValueLabel(int)
|
||||
controlP5.Controller : Slider setDecimalPrecision(int)
|
||||
controlP5.Controller : Slider setDefaultValue(float)
|
||||
controlP5.Controller : Slider setHeight(int)
|
||||
controlP5.Controller : Slider setId(int)
|
||||
controlP5.Controller : Slider setImage(PImage)
|
||||
controlP5.Controller : Slider setImage(PImage, int)
|
||||
controlP5.Controller : Slider setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Slider setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Slider setLabel(String)
|
||||
controlP5.Controller : Slider setLabelVisible(boolean)
|
||||
controlP5.Controller : Slider setLock(boolean)
|
||||
controlP5.Controller : Slider setMax(float)
|
||||
controlP5.Controller : Slider setMin(float)
|
||||
controlP5.Controller : Slider setMouseOver(boolean)
|
||||
controlP5.Controller : Slider setMoveable(boolean)
|
||||
controlP5.Controller : Slider setPosition(float, float)
|
||||
controlP5.Controller : Slider setPosition(float[])
|
||||
controlP5.Controller : Slider setSize(PImage)
|
||||
controlP5.Controller : Slider setSize(int, int)
|
||||
controlP5.Controller : Slider setStringValue(String)
|
||||
controlP5.Controller : Slider setUpdate(boolean)
|
||||
controlP5.Controller : Slider setValue(float)
|
||||
controlP5.Controller : Slider setValueLabel(String)
|
||||
controlP5.Controller : Slider setValueSelf(float)
|
||||
controlP5.Controller : Slider setView(ControllerView)
|
||||
controlP5.Controller : Slider setVisible(boolean)
|
||||
controlP5.Controller : Slider setWidth(int)
|
||||
controlP5.Controller : Slider show()
|
||||
controlP5.Controller : Slider unlock()
|
||||
controlP5.Controller : Slider unplugFrom(Object)
|
||||
controlP5.Controller : Slider unplugFrom(Object[])
|
||||
controlP5.Controller : Slider unregisterTooltip()
|
||||
controlP5.Controller : Slider update()
|
||||
controlP5.Controller : Slider updateSize()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Slider : ArrayList getTickMarks()
|
||||
controlP5.Slider : Slider setColorTickMark(int)
|
||||
controlP5.Slider : Slider setHandleSize(int)
|
||||
controlP5.Slider : Slider setHeight(int)
|
||||
controlP5.Slider : Slider setMax(float)
|
||||
controlP5.Slider : Slider setMin(float)
|
||||
controlP5.Slider : Slider setNumberOfTickMarks(int)
|
||||
controlP5.Slider : Slider setRange(float, float)
|
||||
controlP5.Slider : Slider setScrollSensitivity(float)
|
||||
controlP5.Slider : Slider setSize(int, int)
|
||||
controlP5.Slider : Slider setSliderMode(int)
|
||||
controlP5.Slider : Slider setTriggerEvent(int)
|
||||
controlP5.Slider : Slider setValue(float)
|
||||
controlP5.Slider : Slider setWidth(int)
|
||||
controlP5.Slider : Slider showTickMarks(boolean)
|
||||
controlP5.Slider : Slider shuffle()
|
||||
controlP5.Slider : Slider snapToTickMarks(boolean)
|
||||
controlP5.Slider : Slider update()
|
||||
controlP5.Slider : TickMark getTickMark(int)
|
||||
controlP5.Slider : float getMax()
|
||||
controlP5.Slider : float getMin()
|
||||
controlP5.Slider : float getValue()
|
||||
controlP5.Slider : float getValuePosition()
|
||||
controlP5.Slider : int getDirection()
|
||||
controlP5.Slider : int getHandleSize()
|
||||
controlP5.Slider : int getNumberOfTickMarks()
|
||||
controlP5.Slider : int getSliderMode()
|
||||
controlP5.Slider : int getTriggerEvent()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:46
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,238 @@
|
|||
/**
|
||||
* ControlP5 Slider2D
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Slider2D Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Slider2D s;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
cp5 = new ControlP5(this);
|
||||
s = cp5.addSlider2D("wave")
|
||||
.setPosition(30,40)
|
||||
.setSize(100,100)
|
||||
.setMinMax(20,10,100,100)
|
||||
.setValue(50,50)
|
||||
//.disableCrosshair()
|
||||
;
|
||||
|
||||
smooth();
|
||||
}
|
||||
|
||||
float cnt;
|
||||
void draw() {
|
||||
background(0);
|
||||
pushMatrix();
|
||||
translate(160,140);
|
||||
noStroke();
|
||||
fill(50);
|
||||
rect(0, -100, 400,200);
|
||||
strokeWeight(1);
|
||||
line(0,0,200, 0);
|
||||
stroke(255);
|
||||
|
||||
for(int i=1;i<400;i++) {
|
||||
float y0 = cos(map(i-1,0,s.getArrayValue()[0],-PI,PI)) * s.getArrayValue()[1];
|
||||
float y1 = cos(map(i,0,s.getArrayValue()[0],-PI,PI)) * s.getArrayValue()[1];
|
||||
line((i-1),y0,i,y1);
|
||||
}
|
||||
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Slider2D Controller
|
||||
use ControlP5.printPublicMethodsFor(Slider2D.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Slider2D in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : Slider2D addCallback(CallbackListener)
|
||||
controlP5.Controller : Slider2D addListener(ControlListener)
|
||||
controlP5.Controller : Slider2D addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Slider2D align(int, int, int, int)
|
||||
controlP5.Controller : Slider2D bringToFront()
|
||||
controlP5.Controller : Slider2D bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Slider2D hide()
|
||||
controlP5.Controller : Slider2D linebreak()
|
||||
controlP5.Controller : Slider2D listen(boolean)
|
||||
controlP5.Controller : Slider2D lock()
|
||||
controlP5.Controller : Slider2D onChange(CallbackListener)
|
||||
controlP5.Controller : Slider2D onClick(CallbackListener)
|
||||
controlP5.Controller : Slider2D onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Slider2D onDrag(CallbackListener)
|
||||
controlP5.Controller : Slider2D onDraw(ControllerView)
|
||||
controlP5.Controller : Slider2D onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Slider2D onEnter(CallbackListener)
|
||||
controlP5.Controller : Slider2D onLeave(CallbackListener)
|
||||
controlP5.Controller : Slider2D onMove(CallbackListener)
|
||||
controlP5.Controller : Slider2D onPress(CallbackListener)
|
||||
controlP5.Controller : Slider2D onRelease(CallbackListener)
|
||||
controlP5.Controller : Slider2D onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Slider2D onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Slider2D onWheel(CallbackListener)
|
||||
controlP5.Controller : Slider2D plugTo(Object)
|
||||
controlP5.Controller : Slider2D plugTo(Object, String)
|
||||
controlP5.Controller : Slider2D plugTo(Object[])
|
||||
controlP5.Controller : Slider2D plugTo(Object[], String)
|
||||
controlP5.Controller : Slider2D registerProperty(String)
|
||||
controlP5.Controller : Slider2D registerProperty(String, String)
|
||||
controlP5.Controller : Slider2D registerTooltip(String)
|
||||
controlP5.Controller : Slider2D removeBehavior()
|
||||
controlP5.Controller : Slider2D removeCallback()
|
||||
controlP5.Controller : Slider2D removeCallback(CallbackListener)
|
||||
controlP5.Controller : Slider2D removeListener(ControlListener)
|
||||
controlP5.Controller : Slider2D removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Slider2D removeListenersFor(int)
|
||||
controlP5.Controller : Slider2D removeProperty(String)
|
||||
controlP5.Controller : Slider2D removeProperty(String, String)
|
||||
controlP5.Controller : Slider2D setArrayValue(float[])
|
||||
controlP5.Controller : Slider2D setArrayValue(int, float)
|
||||
controlP5.Controller : Slider2D setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Slider2D setBroadcast(boolean)
|
||||
controlP5.Controller : Slider2D setCaptionLabel(String)
|
||||
controlP5.Controller : Slider2D setColor(CColor)
|
||||
controlP5.Controller : Slider2D setColorActive(int)
|
||||
controlP5.Controller : Slider2D setColorBackground(int)
|
||||
controlP5.Controller : Slider2D setColorCaptionLabel(int)
|
||||
controlP5.Controller : Slider2D setColorForeground(int)
|
||||
controlP5.Controller : Slider2D setColorLabel(int)
|
||||
controlP5.Controller : Slider2D setColorValue(int)
|
||||
controlP5.Controller : Slider2D setColorValueLabel(int)
|
||||
controlP5.Controller : Slider2D setDecimalPrecision(int)
|
||||
controlP5.Controller : Slider2D setDefaultValue(float)
|
||||
controlP5.Controller : Slider2D setHeight(int)
|
||||
controlP5.Controller : Slider2D setId(int)
|
||||
controlP5.Controller : Slider2D setImage(PImage)
|
||||
controlP5.Controller : Slider2D setImage(PImage, int)
|
||||
controlP5.Controller : Slider2D setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Slider2D setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Slider2D setLabel(String)
|
||||
controlP5.Controller : Slider2D setLabelVisible(boolean)
|
||||
controlP5.Controller : Slider2D setLock(boolean)
|
||||
controlP5.Controller : Slider2D setMax(float)
|
||||
controlP5.Controller : Slider2D setMin(float)
|
||||
controlP5.Controller : Slider2D setMouseOver(boolean)
|
||||
controlP5.Controller : Slider2D setMoveable(boolean)
|
||||
controlP5.Controller : Slider2D setPosition(float, float)
|
||||
controlP5.Controller : Slider2D setPosition(float[])
|
||||
controlP5.Controller : Slider2D setSize(PImage)
|
||||
controlP5.Controller : Slider2D setSize(int, int)
|
||||
controlP5.Controller : Slider2D setStringValue(String)
|
||||
controlP5.Controller : Slider2D setUpdate(boolean)
|
||||
controlP5.Controller : Slider2D setValue(float)
|
||||
controlP5.Controller : Slider2D setValueLabel(String)
|
||||
controlP5.Controller : Slider2D setValueSelf(float)
|
||||
controlP5.Controller : Slider2D setView(ControllerView)
|
||||
controlP5.Controller : Slider2D setVisible(boolean)
|
||||
controlP5.Controller : Slider2D setWidth(int)
|
||||
controlP5.Controller : Slider2D show()
|
||||
controlP5.Controller : Slider2D unlock()
|
||||
controlP5.Controller : Slider2D unplugFrom(Object)
|
||||
controlP5.Controller : Slider2D unplugFrom(Object[])
|
||||
controlP5.Controller : Slider2D unregisterTooltip()
|
||||
controlP5.Controller : Slider2D update()
|
||||
controlP5.Controller : Slider2D updateSize()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Slider2D : Slider2D disableCrosshair()
|
||||
controlP5.Slider2D : Slider2D enableCrosshair()
|
||||
controlP5.Slider2D : Slider2D setArrayValue(float[])
|
||||
controlP5.Slider2D : Slider2D setCursorX(float)
|
||||
controlP5.Slider2D : Slider2D setCursorY(float)
|
||||
controlP5.Slider2D : Slider2D setMaxX(float)
|
||||
controlP5.Slider2D : Slider2D setMaxY(float)
|
||||
controlP5.Slider2D : Slider2D setMinMax(float, float, float, float)
|
||||
controlP5.Slider2D : Slider2D setMinX(float)
|
||||
controlP5.Slider2D : Slider2D setMinY(float)
|
||||
controlP5.Slider2D : Slider2D setValue(float)
|
||||
controlP5.Slider2D : Slider2D setValue(float, float)
|
||||
controlP5.Slider2D : Slider2D shuffle()
|
||||
controlP5.Slider2D : float getCursorHeight()
|
||||
controlP5.Slider2D : float getCursorWidth()
|
||||
controlP5.Slider2D : float getCursorX()
|
||||
controlP5.Slider2D : float getCursorY()
|
||||
controlP5.Slider2D : float getMaxX()
|
||||
controlP5.Slider2D : float getMaxY()
|
||||
controlP5.Slider2D : float getMinX()
|
||||
controlP5.Slider2D : float getMinY()
|
||||
controlP5.Slider2D : float[] getArrayValue()
|
||||
controlP5.Slider2D : void setValueLabelSeparator(String)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:47
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,236 @@
|
|||
/**
|
||||
* ControlP5 Tab
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Tab Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(128);
|
||||
|
||||
int sliderValue = 100;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// By default all controllers are stored inside Tab 'default'
|
||||
// add a second tab with name 'extra'
|
||||
|
||||
cp5.addTab("extra")
|
||||
.setColorBackground(color(0, 160, 100))
|
||||
.setColorLabel(color(255))
|
||||
.setColorActive(color(255,128,0))
|
||||
;
|
||||
|
||||
// if you want to receive a controlEvent when
|
||||
// a tab is clicked, use activeEvent(true)
|
||||
|
||||
cp5.getTab("default")
|
||||
.activateEvent(true)
|
||||
.setLabel("my default tab")
|
||||
.setId(1)
|
||||
;
|
||||
|
||||
cp5.getTab("extra")
|
||||
.activateEvent(true)
|
||||
.setId(2)
|
||||
;
|
||||
|
||||
|
||||
// create a few controllers
|
||||
|
||||
cp5.addButton("button")
|
||||
.setBroadcast(false)
|
||||
.setPosition(100,100)
|
||||
.setSize(80,40)
|
||||
.setValue(1)
|
||||
.setBroadcast(true)
|
||||
.getCaptionLabel().align(CENTER,CENTER)
|
||||
;
|
||||
|
||||
cp5.addButton("buttonValue")
|
||||
.setBroadcast(false)
|
||||
.setPosition(220,100)
|
||||
.setSize(80,40)
|
||||
.setValue(2)
|
||||
.setBroadcast(true)
|
||||
.getCaptionLabel().align(CENTER,CENTER)
|
||||
;
|
||||
|
||||
cp5.addSlider("slider")
|
||||
.setBroadcast(false)
|
||||
.setRange(100,200)
|
||||
.setValue(128)
|
||||
.setPosition(100,160)
|
||||
.setSize(200,20)
|
||||
.setBroadcast(true)
|
||||
;
|
||||
|
||||
cp5.addSlider("sliderValue")
|
||||
.setBroadcast(false)
|
||||
.setRange(0,255)
|
||||
.setValue(128)
|
||||
.setPosition(100,200)
|
||||
.setSize(200,20)
|
||||
.setBroadcast(true)
|
||||
;
|
||||
|
||||
// arrange controller in separate tabs
|
||||
|
||||
cp5.getController("sliderValue").moveTo("extra");
|
||||
cp5.getController("slider").moveTo("global");
|
||||
|
||||
// Tab 'global' is a tab that lies on top of any
|
||||
// other tab and is always visible
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(sliderValue);
|
||||
rect(0,0,width,100);
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theControlEvent) {
|
||||
if (theControlEvent.isTab()) {
|
||||
println("got an event from tab : "+theControlEvent.getTab().getName()+" with id "+theControlEvent.getTab().getId());
|
||||
}
|
||||
}
|
||||
|
||||
void slider(int theColor) {
|
||||
myColorBackground = color(theColor);
|
||||
println("a slider event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
if(keyCode==TAB) {
|
||||
cp5.getTab("extra").bringToFront();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the Tab Controller
|
||||
use ControlP5.printPublicMethodsFor(Tab.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Tab in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab add(ControllerInterface)
|
||||
controlP5.ControllerGroup : Tab addListener(ControlListener)
|
||||
controlP5.ControllerGroup : Tab bringToFront()
|
||||
controlP5.ControllerGroup : Tab bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : Tab close()
|
||||
controlP5.ControllerGroup : Tab disableCollapse()
|
||||
controlP5.ControllerGroup : Tab enableCollapse()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : Tab hide()
|
||||
controlP5.ControllerGroup : Tab hideArrow()
|
||||
controlP5.ControllerGroup : Tab hideBar()
|
||||
controlP5.ControllerGroup : Tab moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : Tab moveTo(PApplet)
|
||||
controlP5.ControllerGroup : Tab open()
|
||||
controlP5.ControllerGroup : Tab registerProperty(String)
|
||||
controlP5.ControllerGroup : Tab registerProperty(String, String)
|
||||
controlP5.ControllerGroup : Tab remove(CDrawable)
|
||||
controlP5.ControllerGroup : Tab remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : Tab removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : Tab removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : Tab removeProperty(String)
|
||||
controlP5.ControllerGroup : Tab removeProperty(String, String)
|
||||
controlP5.ControllerGroup : Tab setAddress(String)
|
||||
controlP5.ControllerGroup : Tab setArrayValue(float[])
|
||||
controlP5.ControllerGroup : Tab setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : Tab setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : Tab setColor(CColor)
|
||||
controlP5.ControllerGroup : Tab setColorActive(int)
|
||||
controlP5.ControllerGroup : Tab setColorBackground(int)
|
||||
controlP5.ControllerGroup : Tab setColorForeground(int)
|
||||
controlP5.ControllerGroup : Tab setColorLabel(int)
|
||||
controlP5.ControllerGroup : Tab setColorValue(int)
|
||||
controlP5.ControllerGroup : Tab setHeight(int)
|
||||
controlP5.ControllerGroup : Tab setId(int)
|
||||
controlP5.ControllerGroup : Tab setLabel(String)
|
||||
controlP5.ControllerGroup : Tab setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : Tab setMoveable(boolean)
|
||||
controlP5.ControllerGroup : Tab setOpen(boolean)
|
||||
controlP5.ControllerGroup : Tab setPosition(float, float)
|
||||
controlP5.ControllerGroup : Tab setPosition(float[])
|
||||
controlP5.ControllerGroup : Tab setSize(int, int)
|
||||
controlP5.ControllerGroup : Tab setStringValue(String)
|
||||
controlP5.ControllerGroup : Tab setTitle(String)
|
||||
controlP5.ControllerGroup : Tab setUpdate(boolean)
|
||||
controlP5.ControllerGroup : Tab setValue(float)
|
||||
controlP5.ControllerGroup : Tab setVisible(boolean)
|
||||
controlP5.ControllerGroup : Tab setWidth(int)
|
||||
controlP5.ControllerGroup : Tab show()
|
||||
controlP5.ControllerGroup : Tab showArrow()
|
||||
controlP5.ControllerGroup : Tab showBar()
|
||||
controlP5.ControllerGroup : Tab update()
|
||||
controlP5.ControllerGroup : Tab updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
controlP5.Tab : String getStringValue()
|
||||
controlP5.Tab : Tab activateEvent(boolean)
|
||||
controlP5.Tab : Tab bringToFront()
|
||||
controlP5.Tab : Tab moveTo(ControlWindow)
|
||||
controlP5.Tab : Tab setActive(boolean)
|
||||
controlP5.Tab : Tab setAlwaysActive(boolean)
|
||||
controlP5.Tab : Tab setHeight(int)
|
||||
controlP5.Tab : Tab setLabel(String)
|
||||
controlP5.Tab : Tab setValue(float)
|
||||
controlP5.Tab : Tab setWidth(int)
|
||||
controlP5.Tab : boolean isActive()
|
||||
controlP5.Tab : boolean isAlwaysActive()
|
||||
controlP5.Tab : float getValue()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:25:49
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
/**
|
||||
* ControlP5 Textarea
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Textarea Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
Textarea myTextarea;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
myTextarea = cp5.addTextarea("txt")
|
||||
.setPosition(100,100)
|
||||
.setSize(200,200)
|
||||
.setFont(createFont("arial",12))
|
||||
.setLineHeight(14)
|
||||
.setColor(color(128))
|
||||
.setColorBackground(color(255,100))
|
||||
.setColorForeground(color(255,100));
|
||||
;
|
||||
myTextarea.setText("Lorem Ipsum is simply dummy text of the printing and typesetting"
|
||||
+" industry. Lorem Ipsum has been the industry's standard dummy text"
|
||||
+" ever since the 1500s, when an unknown printer took a galley of type"
|
||||
+" and scrambled it to make a type specimen book. It has survived not"
|
||||
+" only five centuries, but also the leap into electronic typesetting,"
|
||||
+" remaining essentially unchanged. It was popularised in the 1960s"
|
||||
+" with the release of Letraset sheets containing Lorem Ipsum passages,"
|
||||
+" and more recently with desktop publishing software like Aldus"
|
||||
+" PageMaker including versions of Lorem Ipsum."
|
||||
);
|
||||
|
||||
cp5.addSlider("changeWidth")
|
||||
.setRange(100,400)
|
||||
.setValue(200)
|
||||
.setPosition(100,20)
|
||||
.setSize(100,19)
|
||||
;
|
||||
|
||||
cp5.addSlider("changeHeight")
|
||||
.setRange(100,400)
|
||||
.setValue(200)
|
||||
.setPosition(100,40)
|
||||
.setSize(100,19)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
if(key=='r') {
|
||||
myTextarea.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."
|
||||
+" Quisque sed velit nec eros scelerisque adipiscing vitae eu sem."
|
||||
+" Quisque malesuada interdum lectus. Pellentesque pellentesque molestie"
|
||||
+" vestibulum. Maecenas ultricies, neque at porttitor lacinia, tellus enim"
|
||||
+" suscipit tortor, ut dapibus orci lorem non ipsum. Mauris ut velit velit."
|
||||
+" Fusce at purus in augue semper tincidunt imperdiet sit amet eros."
|
||||
+" Vestibulum nunc diam, fringilla vitae tristique ut, viverra ut felis."
|
||||
+" Proin aliquet turpis ornare leo aliquam dapibus. Integer dui nisi, condimentum"
|
||||
+" ut sagittis non, fringilla vestibulum sapien. Sed ullamcorper libero et massa"
|
||||
+" congue in facilisis mauris lobortis. Fusce cursus risus sit amet leo imperdiet"
|
||||
+" lacinia faucibus turpis tempus. Pellentesque pellentesque augue sed purus varius"
|
||||
+" sed volutpat dui rhoncus. Lorem ipsum dolor sit amet, consectetur adipiscing elit"
|
||||
);
|
||||
|
||||
} else if(key=='c') {
|
||||
myTextarea.setColor(0xffffffff);
|
||||
}
|
||||
}
|
||||
void draw() {
|
||||
background(0);
|
||||
if(keyPressed && key==' ') {
|
||||
myTextarea.scroll((float)mouseX/(float)width);
|
||||
}
|
||||
if(keyPressed && key=='l') {
|
||||
myTextarea.setLineHeight(mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
void changeWidth(int theValue) {
|
||||
myTextarea.setWidth(theValue);
|
||||
}
|
||||
|
||||
void changeHeight(int theValue) {
|
||||
myTextarea.setHeight(theValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Textarea Controller
|
||||
use ControlP5.printPublicMethodsFor(Textarea.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Textarea in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControllerGroup : CColor getColor()
|
||||
controlP5.ControllerGroup : Canvas addCanvas(Canvas)
|
||||
controlP5.ControllerGroup : ControlWindow getWindow()
|
||||
controlP5.ControllerGroup : Controller getController(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String)
|
||||
controlP5.ControllerGroup : ControllerProperty getProperty(String, String)
|
||||
controlP5.ControllerGroup : Label getCaptionLabel()
|
||||
controlP5.ControllerGroup : Label getValueLabel()
|
||||
controlP5.ControllerGroup : String getAddress()
|
||||
controlP5.ControllerGroup : String getInfo()
|
||||
controlP5.ControllerGroup : String getName()
|
||||
controlP5.ControllerGroup : String getStringValue()
|
||||
controlP5.ControllerGroup : String toString()
|
||||
controlP5.ControllerGroup : Tab getTab()
|
||||
controlP5.ControllerGroup : Textarea add(ControllerInterface)
|
||||
controlP5.ControllerGroup : Textarea addListener(ControlListener)
|
||||
controlP5.ControllerGroup : Textarea bringToFront()
|
||||
controlP5.ControllerGroup : Textarea bringToFront(ControllerInterface)
|
||||
controlP5.ControllerGroup : Textarea close()
|
||||
controlP5.ControllerGroup : Textarea disableCollapse()
|
||||
controlP5.ControllerGroup : Textarea enableCollapse()
|
||||
controlP5.ControllerGroup : Textarea hide()
|
||||
controlP5.ControllerGroup : Textarea hideArrow()
|
||||
controlP5.ControllerGroup : Textarea hideBar()
|
||||
controlP5.ControllerGroup : Textarea moveTo(ControlWindow)
|
||||
controlP5.ControllerGroup : Textarea moveTo(PApplet)
|
||||
controlP5.ControllerGroup : Textarea open()
|
||||
controlP5.ControllerGroup : Textarea registerProperty(String)
|
||||
controlP5.ControllerGroup : Textarea registerProperty(String, String)
|
||||
controlP5.ControllerGroup : Textarea remove(CDrawable)
|
||||
controlP5.ControllerGroup : Textarea remove(ControllerInterface)
|
||||
controlP5.ControllerGroup : Textarea removeCanvas(Canvas)
|
||||
controlP5.ControllerGroup : Textarea removeListener(ControlListener)
|
||||
controlP5.ControllerGroup : Textarea removeProperty(String)
|
||||
controlP5.ControllerGroup : Textarea removeProperty(String, String)
|
||||
controlP5.ControllerGroup : Textarea setAddress(String)
|
||||
controlP5.ControllerGroup : Textarea setArrayValue(float[])
|
||||
controlP5.ControllerGroup : Textarea setArrayValue(int, float)
|
||||
controlP5.ControllerGroup : Textarea setCaptionLabel(String)
|
||||
controlP5.ControllerGroup : Textarea setColor(CColor)
|
||||
controlP5.ControllerGroup : Textarea setColorActive(int)
|
||||
controlP5.ControllerGroup : Textarea setColorBackground(int)
|
||||
controlP5.ControllerGroup : Textarea setColorForeground(int)
|
||||
controlP5.ControllerGroup : Textarea setColorLabel(int)
|
||||
controlP5.ControllerGroup : Textarea setColorValue(int)
|
||||
controlP5.ControllerGroup : Textarea setHeight(int)
|
||||
controlP5.ControllerGroup : Textarea setId(int)
|
||||
controlP5.ControllerGroup : Textarea setLabel(String)
|
||||
controlP5.ControllerGroup : Textarea setMouseOver(boolean)
|
||||
controlP5.ControllerGroup : Textarea setMoveable(boolean)
|
||||
controlP5.ControllerGroup : Textarea setOpen(boolean)
|
||||
controlP5.ControllerGroup : Textarea setPosition(float, float)
|
||||
controlP5.ControllerGroup : Textarea setPosition(float[])
|
||||
controlP5.ControllerGroup : Textarea setSize(int, int)
|
||||
controlP5.ControllerGroup : Textarea setStringValue(String)
|
||||
controlP5.ControllerGroup : Textarea setTitle(String)
|
||||
controlP5.ControllerGroup : Textarea setUpdate(boolean)
|
||||
controlP5.ControllerGroup : Textarea setValue(float)
|
||||
controlP5.ControllerGroup : Textarea setVisible(boolean)
|
||||
controlP5.ControllerGroup : Textarea setWidth(int)
|
||||
controlP5.ControllerGroup : Textarea show()
|
||||
controlP5.ControllerGroup : Textarea showArrow()
|
||||
controlP5.ControllerGroup : Textarea showBar()
|
||||
controlP5.ControllerGroup : Textarea update()
|
||||
controlP5.ControllerGroup : Textarea updateAbsolutePosition()
|
||||
controlP5.ControllerGroup : boolean isBarVisible()
|
||||
controlP5.ControllerGroup : boolean isCollapse()
|
||||
controlP5.ControllerGroup : boolean isMouseOver()
|
||||
controlP5.ControllerGroup : boolean isMoveable()
|
||||
controlP5.ControllerGroup : boolean isOpen()
|
||||
controlP5.ControllerGroup : boolean isUpdate()
|
||||
controlP5.ControllerGroup : boolean isVisible()
|
||||
controlP5.ControllerGroup : boolean setMousePressed(boolean)
|
||||
controlP5.ControllerGroup : float getArrayValue(int)
|
||||
controlP5.ControllerGroup : float getValue()
|
||||
controlP5.ControllerGroup : float[] getArrayValue()
|
||||
controlP5.ControllerGroup : float[] getPosition()
|
||||
controlP5.ControllerGroup : int getHeight()
|
||||
controlP5.ControllerGroup : int getId()
|
||||
controlP5.ControllerGroup : int getWidth()
|
||||
controlP5.ControllerGroup : int listenerSize()
|
||||
controlP5.ControllerGroup : void controlEvent(ControlEvent)
|
||||
controlP5.ControllerGroup : void remove()
|
||||
controlP5.Textarea : Label getValueLabel()
|
||||
controlP5.Textarea : String getStringValue()
|
||||
controlP5.Textarea : String getText()
|
||||
controlP5.Textarea : Textarea append(String)
|
||||
controlP5.Textarea : Textarea append(String, int)
|
||||
controlP5.Textarea : Textarea clear()
|
||||
controlP5.Textarea : Textarea disableColorBackground()
|
||||
controlP5.Textarea : Textarea enableColorBackground()
|
||||
controlP5.Textarea : Textarea hideScrollbar()
|
||||
controlP5.Textarea : Textarea scroll(float)
|
||||
controlP5.Textarea : Textarea setBorderColor(int)
|
||||
controlP5.Textarea : Textarea setColor(int)
|
||||
controlP5.Textarea : Textarea setColorBackground(int)
|
||||
controlP5.Textarea : Textarea setFont(ControlFont)
|
||||
controlP5.Textarea : Textarea setFont(PFont)
|
||||
controlP5.Textarea : Textarea setFont(int)
|
||||
controlP5.Textarea : Textarea setHeight(int)
|
||||
controlP5.Textarea : Textarea setLineHeight(int)
|
||||
controlP5.Textarea : Textarea setScrollActive(int)
|
||||
controlP5.Textarea : Textarea setScrollBackground(int)
|
||||
controlP5.Textarea : Textarea setScrollForeground(int)
|
||||
controlP5.Textarea : Textarea setSize(int, int)
|
||||
controlP5.Textarea : Textarea setText(String)
|
||||
controlP5.Textarea : Textarea setWidth(int)
|
||||
controlP5.Textarea : Textarea showScrollbar()
|
||||
controlP5.Textarea : boolean isScrollable()
|
||||
controlP5.Textarea : float getValue()
|
||||
controlP5.Textarea : void controlEvent(ControlEvent)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:29
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
/**
|
||||
* ControlP5 Textfield
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Textfield Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
String textValue = "";
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
|
||||
PFont font = createFont("arial",20);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addTextfield("input")
|
||||
.setPosition(20,100)
|
||||
.setSize(200,40)
|
||||
.setFont(font)
|
||||
.setFocus(true)
|
||||
.setColor(color(255,0,0))
|
||||
;
|
||||
|
||||
cp5.addTextfield("textValue")
|
||||
.setPosition(20,170)
|
||||
.setSize(200,40)
|
||||
.setFont(createFont("arial",20))
|
||||
.setAutoClear(false)
|
||||
;
|
||||
|
||||
cp5.addBang("clear")
|
||||
.setPosition(240,170)
|
||||
.setSize(80,40)
|
||||
.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)
|
||||
;
|
||||
|
||||
cp5.addTextfield("default")
|
||||
.setPosition(20,350)
|
||||
.setAutoClear(false)
|
||||
;
|
||||
|
||||
textFont(font);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
fill(255);
|
||||
text(cp5.get(Textfield.class,"input").getText(), 360,130);
|
||||
text(textValue, 360,180);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
cp5.get(Textfield.class,"textValue").clear();
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if(theEvent.isAssignableFrom(Textfield.class)) {
|
||||
println("controlEvent: accessing a string from controller '"
|
||||
+theEvent.getName()+"': "
|
||||
+theEvent.getStringValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void input(String theText) {
|
||||
// automatically receives results from controller input
|
||||
println("a textfield event for controller 'input' : "+theText);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Textfield Controller
|
||||
use ControlP5.printPublicMethodsFor(Textfield.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Textfield in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : Textfield addCallback(CallbackListener)
|
||||
controlP5.Controller : Textfield addListener(ControlListener)
|
||||
controlP5.Controller : Textfield addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Textfield align(int, int, int, int)
|
||||
controlP5.Controller : Textfield bringToFront()
|
||||
controlP5.Controller : Textfield bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Textfield hide()
|
||||
controlP5.Controller : Textfield linebreak()
|
||||
controlP5.Controller : Textfield listen(boolean)
|
||||
controlP5.Controller : Textfield lock()
|
||||
controlP5.Controller : Textfield onChange(CallbackListener)
|
||||
controlP5.Controller : Textfield onClick(CallbackListener)
|
||||
controlP5.Controller : Textfield onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Textfield onDrag(CallbackListener)
|
||||
controlP5.Controller : Textfield onDraw(ControllerView)
|
||||
controlP5.Controller : Textfield onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Textfield onEnter(CallbackListener)
|
||||
controlP5.Controller : Textfield onLeave(CallbackListener)
|
||||
controlP5.Controller : Textfield onMove(CallbackListener)
|
||||
controlP5.Controller : Textfield onPress(CallbackListener)
|
||||
controlP5.Controller : Textfield onRelease(CallbackListener)
|
||||
controlP5.Controller : Textfield onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Textfield onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Textfield onWheel(CallbackListener)
|
||||
controlP5.Controller : Textfield plugTo(Object)
|
||||
controlP5.Controller : Textfield plugTo(Object, String)
|
||||
controlP5.Controller : Textfield plugTo(Object[])
|
||||
controlP5.Controller : Textfield plugTo(Object[], String)
|
||||
controlP5.Controller : Textfield registerProperty(String)
|
||||
controlP5.Controller : Textfield registerProperty(String, String)
|
||||
controlP5.Controller : Textfield registerTooltip(String)
|
||||
controlP5.Controller : Textfield removeBehavior()
|
||||
controlP5.Controller : Textfield removeCallback()
|
||||
controlP5.Controller : Textfield removeCallback(CallbackListener)
|
||||
controlP5.Controller : Textfield removeListener(ControlListener)
|
||||
controlP5.Controller : Textfield removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Textfield removeListenersFor(int)
|
||||
controlP5.Controller : Textfield removeProperty(String)
|
||||
controlP5.Controller : Textfield removeProperty(String, String)
|
||||
controlP5.Controller : Textfield setArrayValue(float[])
|
||||
controlP5.Controller : Textfield setArrayValue(int, float)
|
||||
controlP5.Controller : Textfield setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Textfield setBroadcast(boolean)
|
||||
controlP5.Controller : Textfield setCaptionLabel(String)
|
||||
controlP5.Controller : Textfield setColor(CColor)
|
||||
controlP5.Controller : Textfield setColorActive(int)
|
||||
controlP5.Controller : Textfield setColorBackground(int)
|
||||
controlP5.Controller : Textfield setColorCaptionLabel(int)
|
||||
controlP5.Controller : Textfield setColorForeground(int)
|
||||
controlP5.Controller : Textfield setColorLabel(int)
|
||||
controlP5.Controller : Textfield setColorValue(int)
|
||||
controlP5.Controller : Textfield setColorValueLabel(int)
|
||||
controlP5.Controller : Textfield setDecimalPrecision(int)
|
||||
controlP5.Controller : Textfield setDefaultValue(float)
|
||||
controlP5.Controller : Textfield setHeight(int)
|
||||
controlP5.Controller : Textfield setId(int)
|
||||
controlP5.Controller : Textfield setImage(PImage)
|
||||
controlP5.Controller : Textfield setImage(PImage, int)
|
||||
controlP5.Controller : Textfield setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Textfield setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Textfield setLabel(String)
|
||||
controlP5.Controller : Textfield setLabelVisible(boolean)
|
||||
controlP5.Controller : Textfield setLock(boolean)
|
||||
controlP5.Controller : Textfield setMax(float)
|
||||
controlP5.Controller : Textfield setMin(float)
|
||||
controlP5.Controller : Textfield setMouseOver(boolean)
|
||||
controlP5.Controller : Textfield setMoveable(boolean)
|
||||
controlP5.Controller : Textfield setPosition(float, float)
|
||||
controlP5.Controller : Textfield setPosition(float[])
|
||||
controlP5.Controller : Textfield setSize(PImage)
|
||||
controlP5.Controller : Textfield setSize(int, int)
|
||||
controlP5.Controller : Textfield setStringValue(String)
|
||||
controlP5.Controller : Textfield setUpdate(boolean)
|
||||
controlP5.Controller : Textfield setValue(float)
|
||||
controlP5.Controller : Textfield setValueLabel(String)
|
||||
controlP5.Controller : Textfield setValueSelf(float)
|
||||
controlP5.Controller : Textfield setView(ControllerView)
|
||||
controlP5.Controller : Textfield setVisible(boolean)
|
||||
controlP5.Controller : Textfield setWidth(int)
|
||||
controlP5.Controller : Textfield show()
|
||||
controlP5.Controller : Textfield unlock()
|
||||
controlP5.Controller : Textfield unplugFrom(Object)
|
||||
controlP5.Controller : Textfield unplugFrom(Object[])
|
||||
controlP5.Controller : Textfield unregisterTooltip()
|
||||
controlP5.Controller : Textfield update()
|
||||
controlP5.Controller : Textfield updateSize()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Textfield : String getText()
|
||||
controlP5.Textfield : String[] getTextList()
|
||||
controlP5.Textfield : Textfield clear()
|
||||
controlP5.Textfield : Textfield keepFocus(boolean)
|
||||
controlP5.Textfield : Textfield setAutoClear(boolean)
|
||||
controlP5.Textfield : Textfield setColor(int)
|
||||
controlP5.Textfield : Textfield setColorCursor(int)
|
||||
controlP5.Textfield : Textfield setFocus(boolean)
|
||||
controlP5.Textfield : Textfield setFont(ControlFont)
|
||||
controlP5.Textfield : Textfield setFont(PFont)
|
||||
controlP5.Textfield : Textfield setFont(int)
|
||||
controlP5.Textfield : Textfield setHeight(int)
|
||||
controlP5.Textfield : Textfield setInputFilter(int)
|
||||
controlP5.Textfield : Textfield setPasswordMode(boolean)
|
||||
controlP5.Textfield : Textfield setSize(int, int)
|
||||
controlP5.Textfield : Textfield setText(String)
|
||||
controlP5.Textfield : Textfield setValue(String)
|
||||
controlP5.Textfield : Textfield setValue(float)
|
||||
controlP5.Textfield : Textfield setWidth(int)
|
||||
controlP5.Textfield : Textfield submit()
|
||||
controlP5.Textfield : boolean isAutoClear()
|
||||
controlP5.Textfield : boolean isFocus()
|
||||
controlP5.Textfield : int getIndex()
|
||||
controlP5.Textfield : void draw(PGraphics)
|
||||
controlP5.Textfield : void keyEvent(KeyEvent)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:31
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,211 @@
|
|||
/**
|
||||
* ControlP5 Textlabel
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Textlabel Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Textlabel myTextlabelA;
|
||||
Textlabel myTextlabelB;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
myTextlabelA = cp5.addTextlabel("label")
|
||||
.setText("A single ControlP5 textlabel, in yellow.")
|
||||
.setPosition(100,50)
|
||||
.setColorValue(0xffffff00)
|
||||
.setFont(createFont("Georgia",20))
|
||||
;
|
||||
|
||||
myTextlabelB = new Textlabel(cp5,"Another textlabel, not created through ControlP5 needs to be rendered separately by calling Textlabel.draw(PApplet).",100,100,400,200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
myTextlabelB.draw(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Textlabel Controller
|
||||
use ControlP5.printPublicMethodsFor(Textlabel.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Textlabel in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : Textlabel addCallback(CallbackListener)
|
||||
controlP5.Controller : Textlabel addListener(ControlListener)
|
||||
controlP5.Controller : Textlabel addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Textlabel align(int, int, int, int)
|
||||
controlP5.Controller : Textlabel bringToFront()
|
||||
controlP5.Controller : Textlabel bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Textlabel hide()
|
||||
controlP5.Controller : Textlabel linebreak()
|
||||
controlP5.Controller : Textlabel listen(boolean)
|
||||
controlP5.Controller : Textlabel lock()
|
||||
controlP5.Controller : Textlabel onChange(CallbackListener)
|
||||
controlP5.Controller : Textlabel onClick(CallbackListener)
|
||||
controlP5.Controller : Textlabel onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Textlabel onDrag(CallbackListener)
|
||||
controlP5.Controller : Textlabel onDraw(ControllerView)
|
||||
controlP5.Controller : Textlabel onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Textlabel onEnter(CallbackListener)
|
||||
controlP5.Controller : Textlabel onLeave(CallbackListener)
|
||||
controlP5.Controller : Textlabel onMove(CallbackListener)
|
||||
controlP5.Controller : Textlabel onPress(CallbackListener)
|
||||
controlP5.Controller : Textlabel onRelease(CallbackListener)
|
||||
controlP5.Controller : Textlabel onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Textlabel onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Textlabel onWheel(CallbackListener)
|
||||
controlP5.Controller : Textlabel plugTo(Object)
|
||||
controlP5.Controller : Textlabel plugTo(Object, String)
|
||||
controlP5.Controller : Textlabel plugTo(Object[])
|
||||
controlP5.Controller : Textlabel plugTo(Object[], String)
|
||||
controlP5.Controller : Textlabel registerProperty(String)
|
||||
controlP5.Controller : Textlabel registerProperty(String, String)
|
||||
controlP5.Controller : Textlabel registerTooltip(String)
|
||||
controlP5.Controller : Textlabel removeBehavior()
|
||||
controlP5.Controller : Textlabel removeCallback()
|
||||
controlP5.Controller : Textlabel removeCallback(CallbackListener)
|
||||
controlP5.Controller : Textlabel removeListener(ControlListener)
|
||||
controlP5.Controller : Textlabel removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Textlabel removeListenersFor(int)
|
||||
controlP5.Controller : Textlabel removeProperty(String)
|
||||
controlP5.Controller : Textlabel removeProperty(String, String)
|
||||
controlP5.Controller : Textlabel setArrayValue(float[])
|
||||
controlP5.Controller : Textlabel setArrayValue(int, float)
|
||||
controlP5.Controller : Textlabel setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Textlabel setBroadcast(boolean)
|
||||
controlP5.Controller : Textlabel setCaptionLabel(String)
|
||||
controlP5.Controller : Textlabel setColor(CColor)
|
||||
controlP5.Controller : Textlabel setColorActive(int)
|
||||
controlP5.Controller : Textlabel setColorBackground(int)
|
||||
controlP5.Controller : Textlabel setColorCaptionLabel(int)
|
||||
controlP5.Controller : Textlabel setColorForeground(int)
|
||||
controlP5.Controller : Textlabel setColorLabel(int)
|
||||
controlP5.Controller : Textlabel setColorValue(int)
|
||||
controlP5.Controller : Textlabel setColorValueLabel(int)
|
||||
controlP5.Controller : Textlabel setDecimalPrecision(int)
|
||||
controlP5.Controller : Textlabel setDefaultValue(float)
|
||||
controlP5.Controller : Textlabel setHeight(int)
|
||||
controlP5.Controller : Textlabel setId(int)
|
||||
controlP5.Controller : Textlabel setImage(PImage)
|
||||
controlP5.Controller : Textlabel setImage(PImage, int)
|
||||
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Textlabel setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Textlabel setLabel(String)
|
||||
controlP5.Controller : Textlabel setLabelVisible(boolean)
|
||||
controlP5.Controller : Textlabel setLock(boolean)
|
||||
controlP5.Controller : Textlabel setMax(float)
|
||||
controlP5.Controller : Textlabel setMin(float)
|
||||
controlP5.Controller : Textlabel setMouseOver(boolean)
|
||||
controlP5.Controller : Textlabel setMoveable(boolean)
|
||||
controlP5.Controller : Textlabel setPosition(float, float)
|
||||
controlP5.Controller : Textlabel setPosition(float[])
|
||||
controlP5.Controller : Textlabel setSize(PImage)
|
||||
controlP5.Controller : Textlabel setSize(int, int)
|
||||
controlP5.Controller : Textlabel setStringValue(String)
|
||||
controlP5.Controller : Textlabel setUpdate(boolean)
|
||||
controlP5.Controller : Textlabel setValue(float)
|
||||
controlP5.Controller : Textlabel setValueLabel(String)
|
||||
controlP5.Controller : Textlabel setValueSelf(float)
|
||||
controlP5.Controller : Textlabel setView(ControllerView)
|
||||
controlP5.Controller : Textlabel setVisible(boolean)
|
||||
controlP5.Controller : Textlabel setWidth(int)
|
||||
controlP5.Controller : Textlabel show()
|
||||
controlP5.Controller : Textlabel unlock()
|
||||
controlP5.Controller : Textlabel unplugFrom(Object)
|
||||
controlP5.Controller : Textlabel unplugFrom(Object[])
|
||||
controlP5.Controller : Textlabel unregisterTooltip()
|
||||
controlP5.Controller : Textlabel update()
|
||||
controlP5.Controller : Textlabel updateSize()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Textlabel : ControllerStyle getStyle()
|
||||
controlP5.Textlabel : Label get()
|
||||
controlP5.Textlabel : Textlabel append(String, int)
|
||||
controlP5.Textlabel : Textlabel setColor(int)
|
||||
controlP5.Textlabel : Textlabel setFont(ControlFont)
|
||||
controlP5.Textlabel : Textlabel setFont(PFont)
|
||||
controlP5.Textlabel : Textlabel setHeight(int)
|
||||
controlP5.Textlabel : Textlabel setLetterSpacing(int)
|
||||
controlP5.Textlabel : Textlabel setLineHeight(int)
|
||||
controlP5.Textlabel : Textlabel setMultiline(boolean)
|
||||
controlP5.Textlabel : Textlabel setStringValue(String)
|
||||
controlP5.Textlabel : Textlabel setText(String)
|
||||
controlP5.Textlabel : Textlabel setValue(String)
|
||||
controlP5.Textlabel : Textlabel setValue(float)
|
||||
controlP5.Textlabel : Textlabel setWidth(int)
|
||||
controlP5.Textlabel : int getLineHeight()
|
||||
controlP5.Textlabel : void draw()
|
||||
controlP5.Textlabel : void draw(PApplet)
|
||||
controlP5.Textlabel : void draw(PGraphics)
|
||||
controlP5.Textlabel : void draw(int, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:33
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,239 @@
|
|||
|
||||
/**
|
||||
* ControlP5 Toggle
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the Toggle Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int col = color(255);
|
||||
|
||||
boolean toggleValue = false;
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
smooth();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// create a toggle
|
||||
cp5.addToggle("toggleValue")
|
||||
.setPosition(40,100)
|
||||
.setSize(50,20)
|
||||
;
|
||||
|
||||
// create a toggle and change the default look to a (on/off) switch look
|
||||
cp5.addToggle("toggle")
|
||||
.setPosition(40,250)
|
||||
.setSize(50,20)
|
||||
.setValue(true)
|
||||
.setMode(ControlP5.SWITCH)
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
|
||||
pushMatrix();
|
||||
|
||||
if(toggleValue==true) {
|
||||
fill(255,255,220);
|
||||
} else {
|
||||
fill(128,128,110);
|
||||
}
|
||||
translate(280,100);
|
||||
ellipse(0,0,100,100);
|
||||
|
||||
|
||||
translate(0,150);
|
||||
fill(col);
|
||||
ellipse(0,0,40,40);
|
||||
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void toggle(boolean theFlag) {
|
||||
if(theFlag==true) {
|
||||
col = color(255);
|
||||
} else {
|
||||
col = color(100);
|
||||
}
|
||||
println("a toggle event.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Toggle Controller
|
||||
use ControlP5.printPublicMethodsFor(Toggle.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Toggle in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : Toggle addCallback(CallbackListener)
|
||||
controlP5.Controller : Toggle addListener(ControlListener)
|
||||
controlP5.Controller : Toggle addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Toggle align(int, int, int, int)
|
||||
controlP5.Controller : Toggle bringToFront()
|
||||
controlP5.Controller : Toggle bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Toggle hide()
|
||||
controlP5.Controller : Toggle linebreak()
|
||||
controlP5.Controller : Toggle listen(boolean)
|
||||
controlP5.Controller : Toggle lock()
|
||||
controlP5.Controller : Toggle onChange(CallbackListener)
|
||||
controlP5.Controller : Toggle onClick(CallbackListener)
|
||||
controlP5.Controller : Toggle onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Toggle onDrag(CallbackListener)
|
||||
controlP5.Controller : Toggle onDraw(ControllerView)
|
||||
controlP5.Controller : Toggle onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Toggle onEnter(CallbackListener)
|
||||
controlP5.Controller : Toggle onLeave(CallbackListener)
|
||||
controlP5.Controller : Toggle onMove(CallbackListener)
|
||||
controlP5.Controller : Toggle onPress(CallbackListener)
|
||||
controlP5.Controller : Toggle onRelease(CallbackListener)
|
||||
controlP5.Controller : Toggle onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Toggle onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Toggle onWheel(CallbackListener)
|
||||
controlP5.Controller : Toggle plugTo(Object)
|
||||
controlP5.Controller : Toggle plugTo(Object, String)
|
||||
controlP5.Controller : Toggle plugTo(Object[])
|
||||
controlP5.Controller : Toggle plugTo(Object[], String)
|
||||
controlP5.Controller : Toggle registerProperty(String)
|
||||
controlP5.Controller : Toggle registerProperty(String, String)
|
||||
controlP5.Controller : Toggle registerTooltip(String)
|
||||
controlP5.Controller : Toggle removeBehavior()
|
||||
controlP5.Controller : Toggle removeCallback()
|
||||
controlP5.Controller : Toggle removeCallback(CallbackListener)
|
||||
controlP5.Controller : Toggle removeListener(ControlListener)
|
||||
controlP5.Controller : Toggle removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Toggle removeListenersFor(int)
|
||||
controlP5.Controller : Toggle removeProperty(String)
|
||||
controlP5.Controller : Toggle removeProperty(String, String)
|
||||
controlP5.Controller : Toggle setArrayValue(float[])
|
||||
controlP5.Controller : Toggle setArrayValue(int, float)
|
||||
controlP5.Controller : Toggle setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Toggle setBroadcast(boolean)
|
||||
controlP5.Controller : Toggle setCaptionLabel(String)
|
||||
controlP5.Controller : Toggle setColor(CColor)
|
||||
controlP5.Controller : Toggle setColorActive(int)
|
||||
controlP5.Controller : Toggle setColorBackground(int)
|
||||
controlP5.Controller : Toggle setColorCaptionLabel(int)
|
||||
controlP5.Controller : Toggle setColorForeground(int)
|
||||
controlP5.Controller : Toggle setColorLabel(int)
|
||||
controlP5.Controller : Toggle setColorValue(int)
|
||||
controlP5.Controller : Toggle setColorValueLabel(int)
|
||||
controlP5.Controller : Toggle setDecimalPrecision(int)
|
||||
controlP5.Controller : Toggle setDefaultValue(float)
|
||||
controlP5.Controller : Toggle setHeight(int)
|
||||
controlP5.Controller : Toggle setId(int)
|
||||
controlP5.Controller : Toggle setImage(PImage)
|
||||
controlP5.Controller : Toggle setImage(PImage, int)
|
||||
controlP5.Controller : Toggle setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Toggle setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Toggle setLabel(String)
|
||||
controlP5.Controller : Toggle setLabelVisible(boolean)
|
||||
controlP5.Controller : Toggle setLock(boolean)
|
||||
controlP5.Controller : Toggle setMax(float)
|
||||
controlP5.Controller : Toggle setMin(float)
|
||||
controlP5.Controller : Toggle setMouseOver(boolean)
|
||||
controlP5.Controller : Toggle setMoveable(boolean)
|
||||
controlP5.Controller : Toggle setPosition(float, float)
|
||||
controlP5.Controller : Toggle setPosition(float[])
|
||||
controlP5.Controller : Toggle setSize(PImage)
|
||||
controlP5.Controller : Toggle setSize(int, int)
|
||||
controlP5.Controller : Toggle setStringValue(String)
|
||||
controlP5.Controller : Toggle setUpdate(boolean)
|
||||
controlP5.Controller : Toggle setValue(float)
|
||||
controlP5.Controller : Toggle setValueLabel(String)
|
||||
controlP5.Controller : Toggle setValueSelf(float)
|
||||
controlP5.Controller : Toggle setView(ControllerView)
|
||||
controlP5.Controller : Toggle setVisible(boolean)
|
||||
controlP5.Controller : Toggle setWidth(int)
|
||||
controlP5.Controller : Toggle show()
|
||||
controlP5.Controller : Toggle unlock()
|
||||
controlP5.Controller : Toggle unplugFrom(Object)
|
||||
controlP5.Controller : Toggle unplugFrom(Object[])
|
||||
controlP5.Controller : Toggle unregisterTooltip()
|
||||
controlP5.Controller : Toggle update()
|
||||
controlP5.Controller : Toggle updateSize()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.Toggle : Toggle linebreak()
|
||||
controlP5.Toggle : Toggle setMode(int)
|
||||
controlP5.Toggle : Toggle setState(boolean)
|
||||
controlP5.Toggle : Toggle setValue(boolean)
|
||||
controlP5.Toggle : Toggle setValue(float)
|
||||
controlP5.Toggle : Toggle toggle()
|
||||
controlP5.Toggle : Toggle update()
|
||||
controlP5.Toggle : boolean getBooleanValue()
|
||||
controlP5.Toggle : boolean getState()
|
||||
controlP5.Toggle : int getMode()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:35
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* ControlP5 Tooltip
|
||||
*
|
||||
* Broken with version 2.2.1+
|
||||
*
|
||||
* add a tooltip to a controller.
|
||||
* hover your mouse on top of a slider in the example and wait
|
||||
* for 1 second for the tooltip to appear.
|
||||
*
|
||||
* find a list of public methods available for the Tooltip Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* NOTE: currently does not work for custom PGraphics context
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
float s1 = 20, s2 = 100;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// sorry, Tooltip is currently not working
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cp5.begin(100,100);
|
||||
cp5.addSlider("s1",10,200).linebreak();
|
||||
cp5.addSlider("s2",0,150);
|
||||
cp5.end();
|
||||
|
||||
cp5.getTooltip().setDelay(500);
|
||||
cp5.getTooltip().register("s1","Changes the size of the ellipse.");
|
||||
cp5.getTooltip().register("s2","Changes the Background");
|
||||
|
||||
smooth();
|
||||
noStroke();
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
println("unregistering the tooltip for s2");
|
||||
cp5.getTooltip().unregister("s2");
|
||||
}
|
||||
void draw() {
|
||||
background(s2);
|
||||
fill(255,100);
|
||||
ellipse(width/2, height/2, s1,s1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Tooltip Controller
|
||||
use ControlP5.printPublicMethodsFor(Tooltip.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Tooltip in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Tooltip : Label getLabel()
|
||||
controlP5.Tooltip : Tooltip disable()
|
||||
controlP5.Tooltip : Tooltip enable()
|
||||
controlP5.Tooltip : Tooltip register(Controller, String)
|
||||
controlP5.Tooltip : Tooltip register(String, String)
|
||||
controlP5.Tooltip : Tooltip setAlpha(int)
|
||||
controlP5.Tooltip : Tooltip setBorder(int)
|
||||
controlP5.Tooltip : Tooltip setColorBackground(int)
|
||||
controlP5.Tooltip : Tooltip setColorLabel(int)
|
||||
controlP5.Tooltip : Tooltip setDelay(long)
|
||||
controlP5.Tooltip : Tooltip setHeight(int)
|
||||
controlP5.Tooltip : Tooltip setLabel(Label)
|
||||
controlP5.Tooltip : Tooltip setPositionOffset(float, float)
|
||||
controlP5.Tooltip : Tooltip setView(ControllerView)
|
||||
controlP5.Tooltip : Tooltip setWidth(int)
|
||||
controlP5.Tooltip : Tooltip unregister(Controller)
|
||||
controlP5.Tooltip : Tooltip unregister(String)
|
||||
controlP5.Tooltip : boolean isEnabled()
|
||||
controlP5.Tooltip : int getBorder()
|
||||
controlP5.Tooltip : int getWidth()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:21:36
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
/**
|
||||
* ControlP5 ControlWindow
|
||||
* by andreas schlegel, 2012
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0, 0, 0);
|
||||
|
||||
ControlWindow controlWindow;
|
||||
|
||||
public int sliderValue = 40;
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
|
||||
// PLEASE READ
|
||||
//
|
||||
// With controlP5 2.0 the ControlWindow has been removed,
|
||||
// please see the changelog.txt for details.
|
||||
// Instead, see the extra/ControlP5frame example for
|
||||
// a ControlWindow alternative.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// controlWindow = cp5.addControlWindow("controlP5window", 100, 100, 400, 200)
|
||||
// .hideCoordinates()
|
||||
// .setBackground(color(40))
|
||||
// ;
|
||||
|
||||
cp5.addSlider("sliderValue")
|
||||
.setRange(0, 255)
|
||||
.setPosition(40, 40)
|
||||
.setSize(200, 29)
|
||||
//.moveTo(controlWindow)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(sliderValue);
|
||||
}
|
||||
|
||||
void myTextfield(String theValue) {
|
||||
println(theValue);
|
||||
}
|
||||
|
||||
void myWindowTextfield(String theValue) {
|
||||
println("from controlWindow: "+theValue);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
// if (key==',') cp5.window("controlP5window").hide();
|
||||
// if (key=='.') cp5.window("controlP5window").show();
|
||||
// controlWindow = controlP5.addControlWindow("controlP5window2",600,100,400,200);
|
||||
// controlP5.controller("sliderValue1").moveTo(controlWindow);
|
||||
|
||||
// if (key=='d') {
|
||||
// if (controlWindow.isUndecorated()) {
|
||||
// controlWindow.setUndecorated(false);
|
||||
// } else {
|
||||
// controlWindow.setUndecorated(true);
|
||||
// }
|
||||
// }
|
||||
// if (key=='t') {
|
||||
// controlWindow.toggleUndecorated();
|
||||
// }
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
int x = 20;
|
||||
int y = 8;
|
||||
// init our CustomMatrix
|
||||
CustomMatrix m = new CustomMatrix(cp5, "matrix");
|
||||
// set parameters for our CustomMatrix
|
||||
m.setPosition(50, 100)
|
||||
.setSize(200, 200)
|
||||
.setInterval(200)
|
||||
.setGrid(x,y)
|
||||
.setMode(ControlP5.MULTIPLES)
|
||||
.setColorBackground(color(120))
|
||||
.setBackground(color(40));
|
||||
|
||||
// initialize the presets for the CustomMatrix
|
||||
m.initPresets();
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
// function called by our CustomMatrix with name matrix
|
||||
public void matrix(int x, int y) {
|
||||
println("trigger", x, y);
|
||||
}
|
||||
|
||||
|
||||
// extend the Matrix class since we need to override the Matrix's sequencer
|
||||
class CustomMatrix extends Matrix {
|
||||
|
||||
// add a list to store some presets
|
||||
ArrayList<int[][]> presets = new ArrayList<int[][]>();
|
||||
int currentPreset = 0;
|
||||
Thread update;
|
||||
|
||||
CustomMatrix(ControlP5 cp5, String theName) {
|
||||
super(cp5, theName);
|
||||
stop(); // stop the default sequencer and
|
||||
// create our custom sequencer thread. Here we
|
||||
// check if the sequencer has reached the end and if so
|
||||
// we updated to the next preset.
|
||||
update = new Thread(theName) {
|
||||
public void run( ) {
|
||||
while ( true ) {
|
||||
cnt++;
|
||||
cnt %= _myCellX;
|
||||
if (cnt==0) {
|
||||
// we reached the end and go back to start and
|
||||
// update the preset
|
||||
next();
|
||||
}
|
||||
trigger(cnt);
|
||||
try {
|
||||
sleep( _myInterval );
|
||||
}
|
||||
catch ( InterruptedException e ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
update.start();
|
||||
}
|
||||
|
||||
|
||||
void next() {
|
||||
currentPreset++;
|
||||
currentPreset %= presets.size();
|
||||
setCells(presets.get(currentPreset));
|
||||
}
|
||||
|
||||
// initialize some random presets.
|
||||
void initPresets() {
|
||||
for (int i=0;i<4;i++) {
|
||||
presets.add(createPreset(_myCellX, _myCellY));
|
||||
}
|
||||
setCells(presets.get(0));
|
||||
}
|
||||
|
||||
// create a random preset
|
||||
int[][] createPreset(int theX, int theY) {
|
||||
int[][] preset = new int[theX][theY];
|
||||
for (int x=0;x<theX;x++) {
|
||||
for (int y=0;y<theY;y++) {
|
||||
preset[x][y] = random(1)>0.5 ? 1:0;
|
||||
}
|
||||
}
|
||||
return preset;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,187 @@
|
|||
|
||||
/**
|
||||
* ControlP5 MenuList
|
||||
*
|
||||
* A custom Controller, a scrollable Menu List, using a PGraphics buffer.
|
||||
* Allows custom designs for List Item.
|
||||
*
|
||||
* by Andreas Schlegel, 2013
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
import static controlP5.ControlP5.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
PFont f1, f2;
|
||||
void setup() {
|
||||
size(800, 500, P3D );
|
||||
f1 = createFont("Helvetica", 20);
|
||||
f2 = createFont("Helvetica", 12);
|
||||
|
||||
cp5 = new ControlP5( this );
|
||||
|
||||
|
||||
/* create a custom MenuList with name menu, notice that function
|
||||
* menu will be called when a menu item has been clicked.
|
||||
*/
|
||||
MenuList m = new MenuList( cp5, "menu", 200, 368 );
|
||||
|
||||
m.setPosition(40, 40);
|
||||
// add some items to our menuList
|
||||
for (int i=0;i<100;i++) {
|
||||
m.addItem(makeItem("headline-"+i, "subline", "some copy lorem ipsum ", createImage(50, 50, RGB)));
|
||||
}
|
||||
}
|
||||
|
||||
/* a convenience function to build a map that contains our key-value pairs which we will
|
||||
* then use to render each item of the menuList.
|
||||
*/
|
||||
Map<String, Object> makeItem(String theHeadline, String theSubline, String theCopy, PImage theImage) {
|
||||
Map m = new HashMap<String, Object>();
|
||||
m.put("headline", theHeadline);
|
||||
m.put("subline", theSubline);
|
||||
m.put("copy", theCopy);
|
||||
m.put("image", theImage);
|
||||
return m;
|
||||
}
|
||||
|
||||
void menu(int i) {
|
||||
println("got some menu event from item with index "+i);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
if(theEvent.isFrom("menu")){
|
||||
Map m = ((MenuList)theEvent.getController()).getItem(int(theEvent.getValue()));
|
||||
println("got a menu event from item : "+m);
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background( 40 );
|
||||
}
|
||||
|
||||
|
||||
/* A custom Controller that implements a scrollable menuList. Here the controller
|
||||
* uses a PGraphics element to render customizable list items. The menuList can be scrolled
|
||||
* using the scroll-wheel, touchpad, or mouse-drag. Items are triggered by a click. clicking
|
||||
* the scrollbar to the right makes the list scroll to the item correspoinding to the
|
||||
* click-location.
|
||||
*/
|
||||
class MenuList extends Controller<MenuList> {
|
||||
|
||||
float pos, npos;
|
||||
int itemHeight = 100;
|
||||
int scrollerLength = 40;
|
||||
List< Map<String, Object>> items = new ArrayList< Map<String, Object>>();
|
||||
PGraphics menu;
|
||||
boolean updateMenu;
|
||||
|
||||
MenuList(ControlP5 c, String theName, int theWidth, int theHeight) {
|
||||
super( c, theName, 0, 0, theWidth, theHeight );
|
||||
c.register( this );
|
||||
menu = createGraphics(getWidth(), getHeight() );
|
||||
|
||||
setView(new ControllerView<MenuList>() {
|
||||
|
||||
public void display(PGraphics pg, MenuList t ) {
|
||||
if (updateMenu) {
|
||||
updateMenu();
|
||||
}
|
||||
if (inside() ) {
|
||||
menu.beginDraw();
|
||||
int len = -(itemHeight * items.size()) + getHeight();
|
||||
int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) );
|
||||
menu.fill(255 );
|
||||
menu.rect(getWidth()-4, ty, 4, scrollerLength );
|
||||
menu.endDraw();
|
||||
}
|
||||
pg.image(menu, 0, 0);
|
||||
}
|
||||
}
|
||||
);
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
/* only update the image buffer when necessary - to save some resources */
|
||||
void updateMenu() {
|
||||
int len = -(itemHeight * items.size()) + getHeight();
|
||||
npos = constrain(npos, len, 0);
|
||||
pos += (npos - pos) * 0.1;
|
||||
menu.beginDraw();
|
||||
menu.noStroke();
|
||||
menu.background(255, 64 );
|
||||
menu.textFont(cp5.getFont().getFont());
|
||||
menu.pushMatrix();
|
||||
menu.translate( 0, pos );
|
||||
menu.pushMatrix();
|
||||
|
||||
int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size())));
|
||||
int range = ceil((float(getHeight())/float(itemHeight))+1);
|
||||
int i1 = PApplet.min( items.size(), i0 + range );
|
||||
|
||||
menu.translate(0, i0*itemHeight);
|
||||
|
||||
for (int i=i0;i<i1;i++) {
|
||||
Map m = items.get(i);
|
||||
menu.fill(255, 100);
|
||||
menu.rect(0, 0, getWidth(), itemHeight-1 );
|
||||
menu.fill(255);
|
||||
menu.textFont(f1);
|
||||
menu.text(m.get("headline").toString(), 10, 20 );
|
||||
menu.textFont(f2);
|
||||
menu.textLeading(12);
|
||||
menu.text(m.get("subline").toString(), 10, 35 );
|
||||
menu.text(m.get("copy").toString(), 10, 50, 120, 50 );
|
||||
menu.image(((PImage)m.get("image")), 140, 10, 50, 50 );
|
||||
menu.translate( 0, itemHeight );
|
||||
}
|
||||
menu.popMatrix();
|
||||
menu.popMatrix();
|
||||
menu.endDraw();
|
||||
updateMenu = abs(npos-pos)>0.01 ? true:false;
|
||||
}
|
||||
|
||||
/* when detecting a click, check if the click happend to the far right, if yes, scroll to that position,
|
||||
* otherwise do whatever this item of the list is supposed to do.
|
||||
*/
|
||||
public void onClick() {
|
||||
if (getPointer().x()>getWidth()-10) {
|
||||
npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight);
|
||||
updateMenu = true;
|
||||
}
|
||||
else {
|
||||
int len = itemHeight * items.size();
|
||||
int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ;
|
||||
setValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
public void onMove() {
|
||||
}
|
||||
|
||||
public void onDrag() {
|
||||
npos += getPointer().dy() * 2;
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
public void onScroll(int n) {
|
||||
npos += ( n * 4 );
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
void addItem(Map<String, Object> m) {
|
||||
items.add(m);
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
Map<String,Object> getItem(int theIndex) {
|
||||
return items.get(theIndex);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,257 @@
|
|||
|
||||
/**
|
||||
* ControlP5 SilderList
|
||||
*
|
||||
* A custom Controller, a scrollable Menu List, using a PGraphics buffer.
|
||||
* Allows custom designs for List Item.
|
||||
*
|
||||
* you will need a controlP5 version >= 2.1.5
|
||||
* you can download a copy from
|
||||
* http://sojamo.de/files/archive/controlP5-2.1.5.zip
|
||||
*
|
||||
* by Andreas Schlegel, 2013
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
PFont f1;
|
||||
int NUM = 100;
|
||||
float[] rotation = new float[NUM];
|
||||
|
||||
|
||||
void setup() {
|
||||
size(800, 400 ,P3D);
|
||||
f1 = createFont("Helvetica", 12);
|
||||
|
||||
cp5 = new ControlP5( this );
|
||||
|
||||
|
||||
// create a custom SilderList with name menu, notice that function
|
||||
// menu will be called when a menu item has been clicked.
|
||||
|
||||
SilderList m = new SilderList( cp5, "menu", 250, 350 );
|
||||
|
||||
m.setPosition(40, 20);
|
||||
// add some items to our SilderList
|
||||
for (int i=0;i<NUM;i++) {
|
||||
m.addItem(makeItem("slider-"+i, 0, -PI, PI ));
|
||||
}
|
||||
}
|
||||
|
||||
// a convenience function to build a map that contains our key-value
|
||||
// pairs which we will then use to render each item of the SilderList.
|
||||
//
|
||||
Map<String, Object> makeItem(String theLabel, float theValue, float theMin, float theMax) {
|
||||
Map m = new HashMap<String, Object>();
|
||||
m.put("label", theLabel);
|
||||
m.put("sliderValue", theValue);
|
||||
m.put("sliderValueMin", theMin);
|
||||
m.put("sliderValueMax", theMax);
|
||||
return m;
|
||||
}
|
||||
|
||||
void menu(int i) {
|
||||
println("got some slider-list event from item with index "+i);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
if (theEvent.isFrom("menu")) {
|
||||
int index = int(theEvent.getValue());
|
||||
Map m = ((SilderList)theEvent.getController()).getItem(index);
|
||||
println("got a slider event from item : "+m);
|
||||
rotation[index] = f(m.get("sliderValue"));
|
||||
}
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background( 220 );
|
||||
fill(0, 128, 255);
|
||||
noStroke();
|
||||
pushMatrix();
|
||||
translate(width/2, 30 );
|
||||
for (int i=0;i<NUM;i++) {
|
||||
pushMatrix();
|
||||
translate((i%10)*35, int(i/10)*35);
|
||||
rotate(rotation[i]);
|
||||
rect(0, 0, 20, 20);
|
||||
popMatrix();
|
||||
}
|
||||
popMatrix();
|
||||
}
|
||||
|
||||
|
||||
// A custom Controller that implements a scrollable SilderList.
|
||||
// Here the controller uses a PGraphics element to render customizable
|
||||
// list items. The SilderList can be scrolled using the scroll-wheel,
|
||||
// touchpad, or mouse-drag. Slider are triggered by a press or drag.
|
||||
// clicking the scrollbar to the right makes the list scroll to the item
|
||||
// correspoinding to the click-location.
|
||||
|
||||
class SilderList extends Controller<SilderList> {
|
||||
|
||||
float pos, npos;
|
||||
int itemHeight = 60;
|
||||
int scrollerLength = 40;
|
||||
int sliderWidth = 150;
|
||||
int sliderHeight = 15;
|
||||
int sliderX = 10;
|
||||
int sliderY = 25;
|
||||
|
||||
int dragMode = 0;
|
||||
int dragIndex = -1;
|
||||
|
||||
List< Map<String, Object>> items = new ArrayList< Map<String, Object>>();
|
||||
PGraphics menu;
|
||||
boolean updateMenu;
|
||||
|
||||
SilderList(ControlP5 c, String theName, int theWidth, int theHeight) {
|
||||
super( c, theName, 0, 0, theWidth, theHeight );
|
||||
c.register( this );
|
||||
menu = createGraphics(getWidth(), getHeight());
|
||||
|
||||
setView(new ControllerView<SilderList>() {
|
||||
|
||||
public void display(PGraphics pg, SilderList t ) {
|
||||
if (updateMenu) {
|
||||
updateMenu();
|
||||
}
|
||||
if (inside() ) { // draw scrollbar
|
||||
menu.beginDraw();
|
||||
int len = -(itemHeight * items.size()) + getHeight();
|
||||
int ty = int(map(pos, len, 0, getHeight() - scrollerLength - 2, 2 ) );
|
||||
menu.fill( 128 );
|
||||
menu.rect(getWidth()-6, ty, 4, scrollerLength );
|
||||
menu.endDraw();
|
||||
}
|
||||
pg.image(menu, 0, 0);
|
||||
}
|
||||
}
|
||||
);
|
||||
updateMenu();
|
||||
}
|
||||
|
||||
// only update the image buffer when necessary - to save some resources
|
||||
void updateMenu() {
|
||||
int len = -(itemHeight * items.size()) + getHeight();
|
||||
npos = constrain(npos, len, 0);
|
||||
pos += (npos - pos) * 0.1;
|
||||
|
||||
/// draw the SliderList
|
||||
menu.beginDraw();
|
||||
menu.noStroke();
|
||||
menu.background(240);
|
||||
menu.textFont(cp5.getFont().getFont());
|
||||
menu.pushMatrix();
|
||||
menu.translate( 0, int(pos) );
|
||||
menu.pushMatrix();
|
||||
|
||||
int i0 = PApplet.max( 0, int(map(-pos, 0, itemHeight * items.size(), 0, items.size())));
|
||||
int range = ceil((float(getHeight())/float(itemHeight))+1);
|
||||
int i1 = PApplet.min( items.size(), i0 + range );
|
||||
|
||||
menu.translate(0, i0*itemHeight);
|
||||
|
||||
for (int i=i0;i<i1;i++) {
|
||||
Map m = items.get(i);
|
||||
menu.noStroke();
|
||||
menu.fill(200);
|
||||
menu.rect(0, itemHeight-1, getWidth(), 1 );
|
||||
menu.fill(150);
|
||||
// uncomment the following line to use a different font than the default controlP5 font
|
||||
//menu.textFont(f1);
|
||||
String txt = String.format("%s %.2f", m.get("label").toString().toUpperCase(), f(items.get(i).get("sliderValue")));
|
||||
menu.text(txt, 10, 20 );
|
||||
menu.fill(255);
|
||||
menu.rect(sliderX, sliderY, sliderWidth, sliderHeight);
|
||||
menu.fill(100, 230, 128);
|
||||
float min = f(items.get(i).get("sliderValueMin"));
|
||||
float max = f(items.get(i).get("sliderValueMax"));
|
||||
float val = f(items.get(i).get("sliderValue"));
|
||||
menu.rect(sliderX, sliderY, map(val, min, max, 0, sliderWidth), sliderHeight);
|
||||
menu.translate( 0, itemHeight );
|
||||
}
|
||||
menu.popMatrix();
|
||||
menu.popMatrix();
|
||||
menu.endDraw();
|
||||
updateMenu = abs(npos-pos)>0.01 ? true:false;
|
||||
}
|
||||
|
||||
// when detecting a click, check if the click happend to the far right,
|
||||
// if yes, scroll to that position, otherwise do whatever this item of
|
||||
// the list is supposed to do.
|
||||
public void onClick() {
|
||||
if (getPointer().x()>getWidth()-10) {
|
||||
npos= -map(getPointer().y(), 0, getHeight(), 0, items.size()*itemHeight);
|
||||
updateMenu = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onPress() {
|
||||
int x = getPointer().x();
|
||||
int y = (int)(getPointer().y()-pos)%itemHeight;
|
||||
boolean withinSlider = within(x, y, sliderX, sliderY, sliderWidth, sliderHeight);
|
||||
dragMode = withinSlider ? 2:1;
|
||||
if (dragMode==2) {
|
||||
dragIndex = getIndex();
|
||||
float min = f(items.get(dragIndex).get("sliderValueMin"));
|
||||
float max = f(items.get(dragIndex).get("sliderValueMax"));
|
||||
float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max);
|
||||
items.get(dragIndex).put("sliderValue", val);
|
||||
setValue(dragIndex);
|
||||
}
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
public void onDrag() {
|
||||
switch(dragMode) {
|
||||
case(1): // drag and scroll the list
|
||||
npos += getPointer().dy() * 2;
|
||||
updateMenu = true;
|
||||
break;
|
||||
case(2): // drag slider
|
||||
float min = f(items.get(dragIndex).get("sliderValueMin"));
|
||||
float max = f(items.get(dragIndex).get("sliderValueMax"));
|
||||
float val = constrain(map(getPointer().x()-sliderX, 0, sliderWidth, min, max), min, max);
|
||||
items.get(dragIndex).put("sliderValue", val);
|
||||
setValue(dragIndex);
|
||||
updateMenu = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onScroll(int n) {
|
||||
npos += ( n * 4 );
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
void addItem(Map<String, Object> m) {
|
||||
items.add(m);
|
||||
updateMenu = true;
|
||||
}
|
||||
|
||||
Map<String, Object> getItem(int theIndex) {
|
||||
return items.get(theIndex);
|
||||
}
|
||||
|
||||
private int getIndex() {
|
||||
int len = itemHeight * items.size();
|
||||
int index = int( map( getPointer().y() - pos, 0, len, 0, items.size() ) ) ;
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
public static float f( Object o ) {
|
||||
return ( o instanceof Number ) ? ( ( Number ) o ).floatValue( ) : Float.MIN_VALUE;
|
||||
}
|
||||
|
||||
public static boolean within(int theX, int theY, int theX1, int theY1, int theW1, int theH1) {
|
||||
return (theX>theX1 && theX<theX1+theW1 && theY>theY1 && theY<theY1+theH1);
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
import controlP5.*;
|
||||
|
||||
// Editable Numberbox for ControlP5
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
Numberbox n = cp5.addNumberbox("numbers")
|
||||
.setSize(100, 20)
|
||||
.setPosition(100, 100)
|
||||
.setValue(0)
|
||||
;
|
||||
|
||||
makeEditable( n );
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
||||
// function that will be called when controller 'numbers' changes
|
||||
public void numbers(float f) {
|
||||
println("received "+f+" from Numberbox numbers ");
|
||||
}
|
||||
|
||||
|
||||
void makeEditable( Numberbox n ) {
|
||||
// allows the user to click a numberbox and type in a number which is confirmed with RETURN
|
||||
|
||||
|
||||
final NumberboxInput nin = new NumberboxInput( n ); // custom input handler for the numberbox
|
||||
|
||||
// control the active-status of the input handler when releasing the mouse button inside
|
||||
// the numberbox. deactivate input handler when mouse leaves.
|
||||
n.onClick(new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
nin.setActive( true );
|
||||
}
|
||||
}
|
||||
).onLeave(new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
nin.setActive( false ); nin.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
// input handler for a Numberbox that allows the user to
|
||||
// key in numbers with the keyboard to change the value of the numberbox
|
||||
|
||||
public class NumberboxInput {
|
||||
|
||||
String text = "";
|
||||
|
||||
Numberbox n;
|
||||
|
||||
boolean active;
|
||||
|
||||
|
||||
NumberboxInput(Numberbox theNumberbox) {
|
||||
n = theNumberbox;
|
||||
registerMethod("keyEvent", this );
|
||||
}
|
||||
|
||||
public void keyEvent(KeyEvent k) {
|
||||
// only process key event if input is active
|
||||
if (k.getAction()==KeyEvent.PRESS && active) {
|
||||
if (k.getKey()=='\n') { // confirm input with enter
|
||||
submit();
|
||||
return;
|
||||
} else if(k.getKeyCode()==BACKSPACE) {
|
||||
text = text.isEmpty() ? "":text.substring(0, text.length()-1);
|
||||
//text = ""; // clear all text with backspace
|
||||
}
|
||||
else if(k.getKey()<255) {
|
||||
// check if the input is a valid (decimal) number
|
||||
final String regex = "\\d+([.]\\d{0,2})?";
|
||||
String s = text + k.getKey();
|
||||
if ( java.util.regex.Pattern.matches(regex, s ) ) {
|
||||
text += k.getKey();
|
||||
}
|
||||
}
|
||||
n.getValueLabel().setText(this.text);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActive(boolean b) {
|
||||
active = b;
|
||||
if(active) {
|
||||
n.getValueLabel().setText("");
|
||||
text = "";
|
||||
}
|
||||
}
|
||||
|
||||
public void submit() {
|
||||
if (!text.isEmpty()) {
|
||||
n.setValue( float( text ) );
|
||||
text = "";
|
||||
}
|
||||
else {
|
||||
n.getValueLabel().setText(""+n.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* ControlP5 ControlP5graphics
|
||||
*
|
||||
* shows you how to render controlP5 instances into a PGraphics buffer.
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 c1 , c2;
|
||||
PGraphics panel1 , panel2;
|
||||
|
||||
void setup() {
|
||||
size( 1024, 500 ,P3D );
|
||||
|
||||
/* create 2 buffers */
|
||||
panel1 = createGraphics( 200 , height/2 );
|
||||
panel2 = createGraphics( 200 , height/2 );
|
||||
|
||||
/* create the first instance of ControlP5 which will be rendered into panel1 */
|
||||
c1 = new ControlP5( this );
|
||||
c1.enableShortcuts();
|
||||
c1.setBackground( color( 0 , 50 ) );
|
||||
c1.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||
c1.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||
c1.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||
c1.setGraphics( panel1 , 0 , 0 );
|
||||
|
||||
/* create the second instance of ControlP5 which will be rendered into panel2 */
|
||||
c2 = new ControlP5( this );
|
||||
c2.enableShortcuts();
|
||||
c2.setBackground( color( 0 , 50 ) );
|
||||
c2.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||
c2.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||
c2.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||
c2.setGraphics( panel2 , 220 , 0 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background( 100 , 0 , 0 );
|
||||
/* to change location, un-comment line below */
|
||||
// c1.setGraphics( panel1 , int(sin(frameCount*0.1) * 100) , 0 );
|
||||
}
|
||||
|
||||
|
||||
void controlEvent( ControlEvent ce) {
|
||||
println(ce);
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
|
||||
/**
|
||||
* ControlP5 MidiMapper
|
||||
*
|
||||
* Maps midi input to controlP5 controllers.
|
||||
* This will eventually result in a library.
|
||||
*
|
||||
* by Andreas Schlegel, 2013
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import controlP5.*;
|
||||
import javax.sound.midi.Receiver;
|
||||
import javax.sound.midi.MidiMessage;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Map<String, String> midimapper = new HashMap<String, String>();
|
||||
|
||||
void setup() {
|
||||
|
||||
size( 600, 400 );
|
||||
|
||||
cp5 = new ControlP5( this );
|
||||
|
||||
cp5.begin(cp5.addTab("a"));
|
||||
cp5.addSlider("a-1").setPosition(20, 120).setSize(200, 20);
|
||||
cp5.addSlider("a-2").setPosition(20, 160).setSize(200, 20);
|
||||
cp5.addSlider("a-3").setPosition(20, 200).setSize(200, 20);
|
||||
cp5.addToggle("a-4").setPosition(280, 120).setSize(100, 20);
|
||||
cp5.addButton("a-5").setPosition(280, 160).setSize(100, 20);
|
||||
cp5.addBang("a-6").setPosition(280, 200).setSize(100, 20);
|
||||
cp5.end();
|
||||
|
||||
cp5.begin(cp5.addTab("b"));
|
||||
cp5.addSlider("b-1").setPosition(20, 120).setSize(200, 20);
|
||||
cp5.addSlider("b-2").setPosition(20, 160).setSize(200, 20);
|
||||
cp5.addSlider("b-3").setPosition(20, 200).setSize(200, 20);
|
||||
cp5.end();
|
||||
|
||||
final String device = "SLIDER/KNOB";
|
||||
|
||||
//midimapper.clear();
|
||||
|
||||
midimapper.put( ref( device, 0 ), "a-1" );
|
||||
midimapper.put( ref( device, 1 ), "a-2" );
|
||||
midimapper.put( ref( device, 2 ), "a-3" );
|
||||
midimapper.put( ref( device, 32 ), "a-4" );
|
||||
midimapper.put( ref( device, 48 ), "a-5" );
|
||||
midimapper.put( ref( device, 64 ), "a-6" );
|
||||
|
||||
midimapper.put( ref( device, 16 ), "b-1" );
|
||||
midimapper.put( ref( device, 17 ), "b-2" );
|
||||
midimapper.put( ref( device, 18 ), "b-3" );
|
||||
|
||||
boolean DEBUG = false;
|
||||
|
||||
if (DEBUG) {
|
||||
new MidiSimple( device );
|
||||
}
|
||||
else {
|
||||
new MidiSimple( device , new Receiver() {
|
||||
|
||||
@Override public void send( MidiMessage msg, long timeStamp ) {
|
||||
|
||||
byte[] b = msg.getMessage();
|
||||
|
||||
if ( b[ 0 ] != -48 ) {
|
||||
|
||||
Object index = ( midimapper.get( ref( device , b[ 1 ] ) ) );
|
||||
|
||||
if ( index != null ) {
|
||||
|
||||
Controller c = cp5.getController(index.toString());
|
||||
if (c instanceof Slider ) {
|
||||
float min = c.getMin();
|
||||
float max = c.getMax();
|
||||
c.setValue(map(b[ 2 ], 0, 127, min, max) );
|
||||
} else if ( c instanceof Button ) {
|
||||
if ( b[ 2 ] > 0 ) {
|
||||
c.setValue( c.getValue( ) );
|
||||
c.setColorBackground( 0xff08a2cf );
|
||||
} else {
|
||||
c.setColorBackground( 0xff003652 );
|
||||
}
|
||||
} else if ( c instanceof Bang ) {
|
||||
if ( b[ 2 ] > 0 ) {
|
||||
c.setValue( c.getValue( ) );
|
||||
c.setColorForeground( 0xff08a2cf );
|
||||
} else {
|
||||
c.setColorForeground( 0xff00698c );
|
||||
}
|
||||
} else if ( c instanceof Toggle ) {
|
||||
if ( b[ 2 ] > 0 ) {
|
||||
( ( Toggle ) c ).toggle( );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void close( ) {
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String ref(String theDevice, int theIndex) {
|
||||
return theDevice+"-"+theIndex;
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background( 0 );
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.sound.midi.MidiDevice;
|
||||
import javax.sound.midi.MidiMessage;
|
||||
import javax.sound.midi.MidiSystem;
|
||||
import javax.sound.midi.MidiUnavailableException;
|
||||
import javax.sound.midi.Receiver;
|
||||
import javax.sound.midi.Transmitter;
|
||||
|
||||
public class MidiSimple {
|
||||
|
||||
public MidiSimple( String theDeviceName , Receiver theReceiver ) {
|
||||
|
||||
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
|
||||
for ( int i = 0; i < aInfos.length; i++ ) {
|
||||
try {
|
||||
MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] );
|
||||
boolean bAllowsInput = ( device.getMaxTransmitters() != 0 );
|
||||
boolean bAllowsOutput = ( device.getMaxReceivers() != 0 );
|
||||
System.out.println( "" + i + " " + ( bAllowsInput ? "IN " : " " ) + ( bAllowsOutput ? "OUT " : " " ) + aInfos[ i ].getName() + ", " + aInfos[ i ].getVendor() + ", "
|
||||
+ aInfos[ i ].getVersion() + ", " + aInfos[ i ].getDescription() );
|
||||
}
|
||||
catch ( MidiUnavailableException e ) {
|
||||
// device is obviously not available...
|
||||
// out(e);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
MidiDevice device;
|
||||
device = MidiSystem.getMidiDevice( getMidiDeviceInfo( theDeviceName, false ) );
|
||||
device.open();
|
||||
Transmitter conTrans = device.getTransmitter();
|
||||
conTrans.setReceiver( theReceiver );
|
||||
}
|
||||
catch ( MidiUnavailableException e ) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("No Midi device ( "+theDeviceName+" ) is available.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public MidiSimple( String theDeviceName ) {
|
||||
new MidiSimple(theDeviceName , new MidiInputReceiver( theDeviceName ) );
|
||||
}
|
||||
|
||||
|
||||
public MidiDevice.Info getMidiDeviceInfo( String strDeviceName, boolean bForOutput ) {
|
||||
MidiDevice.Info[] aInfos = MidiSystem.getMidiDeviceInfo();
|
||||
for ( int i = 0; i < aInfos.length; i++ ) {
|
||||
if ( aInfos[ i ].getName().equals( strDeviceName ) ) {
|
||||
try {
|
||||
MidiDevice device = MidiSystem.getMidiDevice( aInfos[ i ] );
|
||||
boolean bAllowsInput = ( device.getMaxTransmitters() != 0 );
|
||||
boolean bAllowsOutput = ( device.getMaxReceivers() != 0 );
|
||||
if ( ( bAllowsOutput && bForOutput ) || ( bAllowsInput && !bForOutput ) ) {
|
||||
return aInfos[ i ];
|
||||
}
|
||||
}
|
||||
catch ( MidiUnavailableException e ) {
|
||||
// TODO:
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class MidiInputReceiver implements Receiver {
|
||||
public String name;
|
||||
Map< Byte, String > commandMap = new HashMap< Byte, String >();
|
||||
|
||||
public MidiInputReceiver( String name ) {
|
||||
this.name = name;
|
||||
commandMap.put( ( byte ) -112, "Note On" );
|
||||
commandMap.put( ( byte ) -128, "Note Off" );
|
||||
commandMap.put( ( byte ) -48, "Channel Pressure" );
|
||||
commandMap.put( ( byte ) -80, "Continuous Controller" );
|
||||
}
|
||||
|
||||
public void send( MidiMessage msg, long timeStamp ) {
|
||||
System.out.println( "midi received (" + name + ")" );
|
||||
System.out.println( "Timestamp: " + timeStamp );
|
||||
byte[] b = msg.getMessage();
|
||||
|
||||
if ( b[ 0 ] != -48 ) {
|
||||
// System.out.println("Message length: " + msg.getLength());
|
||||
System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) );
|
||||
System.out.println( "Which note: " + b[ 1 ] );
|
||||
System.out.println( "Note pressure: " + b[ 2 ] );
|
||||
System.out.println( "---------------------" );
|
||||
}
|
||||
else {
|
||||
// System.out.println("Message length: " + msg.getLength());
|
||||
System.out.println( "Note command: " + commandMap.get( b[ 0 ] ) );
|
||||
System.out.println( "Note Pressure: " + b[ 1 ] );
|
||||
System.out.println( "---------------------" );
|
||||
}
|
||||
}
|
||||
|
||||
public void close( ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* ControlP5 Autodetect Fields
|
||||
*
|
||||
* test sketch, controller values will automatically be set
|
||||
* to its corresponding sketch fields.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
int s1 = 50;
|
||||
int s2 = 50;
|
||||
|
||||
int nb1 = 50;
|
||||
int nb2 = 50;
|
||||
|
||||
int k1 = 50;
|
||||
int k2 = 50;
|
||||
|
||||
boolean t1 = false;
|
||||
boolean t2 = false;
|
||||
|
||||
int r1 = 20;
|
||||
int r2 = 50;
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
ControlP5 cp5 = new ControlP5(this);
|
||||
cp5.addSlider("s1",10,150,10,10,100,15).setLabel("50");
|
||||
cp5.addSlider("s2",10,150,20,150,10,100,15).setLabel("20");
|
||||
|
||||
cp5.addNumberbox("nb1",10,50,100,15).setLabel("50");
|
||||
cp5.addNumberbox("nb2",20,150,50,100,15).setLabel("20");
|
||||
|
||||
cp5.addKnob("k1",10,150,10,150,50).setLabel("50");
|
||||
cp5.addKnob("k2",10,150,20,150,150,50).setLabel("20");
|
||||
|
||||
cp5.addToggle("t1",10,240,100,15).setLabel("false");
|
||||
cp5.addToggle("t2",true,150,240,100,15).setLabel("true");
|
||||
|
||||
cp5.addButton("b1",50,10,280,100,15).setLabel("50");
|
||||
cp5.addButton("b2",20,150,280,100,15).setLabel("20");
|
||||
|
||||
cp5.addRange("r1",10,150,r1,r2,10,320,100,15).setLabel("50");
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent c) {
|
||||
println(c.getValue());
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
Test t;
|
||||
void setup() {
|
||||
size(400,400);
|
||||
cp5 = new ControlP5( this );
|
||||
t = new Test( "test" );
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(20);
|
||||
println( t.value );
|
||||
}
|
||||
|
||||
class Test {
|
||||
|
||||
int value;
|
||||
|
||||
Test( String thePrefix ) {
|
||||
cp5.addSlider( "value-"+thePrefix )
|
||||
.setRange( 0, 255 )
|
||||
.plugTo( this, "setValue" )
|
||||
.setValue( 127 )
|
||||
.setLabel("value")
|
||||
;
|
||||
}
|
||||
|
||||
void setValue(int theValue) {
|
||||
value = theValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/**
|
||||
* ControlP5 DrawIntoCanvas
|
||||
*
|
||||
* this example demonstrates how to draw into a Canvas.
|
||||
* Click and drag the mouse to show and draw into the Canvas.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Canvas cc;
|
||||
|
||||
// your controlWindowCanvas class
|
||||
class MyCanvas extends Canvas {
|
||||
|
||||
boolean mousePressed;
|
||||
int mouseX, mouseY;
|
||||
public void update(PApplet theApplet) {
|
||||
mousePressed = theApplet.mousePressed;
|
||||
mouseX = theApplet.mouseX;
|
||||
mouseY = theApplet.mouseY;
|
||||
}
|
||||
|
||||
public void draw(PGraphics theApplet) {
|
||||
theApplet.background(255);
|
||||
// a rectangle will be drawn if the mouse has been
|
||||
// pressed inside the main sketch window.
|
||||
// mousePressed here refers to the mousePressed
|
||||
// variable of your main sketch
|
||||
if(mousePressed) {
|
||||
theApplet.fill(255,0,0);
|
||||
theApplet.rect(10,10,100,100);
|
||||
theApplet.fill(0);
|
||||
theApplet.ellipse(mouseX,mouseY,20,20);
|
||||
}
|
||||
// will draw a rectangle into the controlWindow
|
||||
// if the mouse has been pressed inside the controlWindow itself.
|
||||
// theApplet.mousePressed here refers to the
|
||||
// mousePressed variable of the controlWindow.
|
||||
if(mousePressed) {
|
||||
theApplet.fill(0);
|
||||
theApplet.rect(10,10,100,100);
|
||||
theApplet.fill(255,0,0);
|
||||
theApplet.ellipse(mouseX,mouseY,20,20);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
frameRate(30);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cc = new MyCanvas();
|
||||
cc.pre();
|
||||
cp5.addCanvas(cc);
|
||||
|
||||
}
|
||||
|
||||
void draw(){
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
/**
|
||||
* ControlP5 ControlP5chartsCombined
|
||||
*
|
||||
* find a list of public methods available for the Chart Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Chart myChart;
|
||||
|
||||
void setup() {
|
||||
size(400, 700);
|
||||
smooth();
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.printPublicMethodsFor(Chart.class);
|
||||
myChart = cp5.addChart("hello")
|
||||
.setPosition(50, 50)
|
||||
.setSize(200, 200)
|
||||
.setRange(-20, 20)
|
||||
.setView(Chart.BAR) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
|
||||
;
|
||||
|
||||
myChart.getColor().setBackground(color(255, 100));
|
||||
|
||||
|
||||
myChart.addDataSet("world");
|
||||
myChart.setColors("world", color(255,0,255),color(255,0,0));
|
||||
myChart.setData("world", new float[4]);
|
||||
|
||||
myChart.setStrokeWeight(1.5);
|
||||
|
||||
myChart.addDataSet("earth");
|
||||
myChart.setColors("earth", color(255), color(0, 255, 0));
|
||||
myChart.updateData("earth", 1, 2, 10, 3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
// unshift: add data from left to right (first in)
|
||||
myChart.unshift("world", (sin(frameCount*0.01)*10));
|
||||
|
||||
// push: add data from right to left (last in)
|
||||
myChart.push("earth", (sin(frameCount*0.1)*10));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the Chart Controller
|
||||
use ControlP5.printPublicMethodsFor(Chart.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Chart in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Chart : Chart addData(ChartData)
|
||||
controlP5.Chart : Chart addData(ChartDataSet, float)
|
||||
controlP5.Chart : Chart addData(String, ChartData)
|
||||
controlP5.Chart : Chart addData(String, float)
|
||||
controlP5.Chart : Chart addData(float)
|
||||
controlP5.Chart : Chart addDataSet(String)
|
||||
controlP5.Chart : Chart addFirst(String, float)
|
||||
controlP5.Chart : Chart addFirst(float)
|
||||
controlP5.Chart : Chart addLast(String, float)
|
||||
controlP5.Chart : Chart addLast(float)
|
||||
controlP5.Chart : Chart push(String, float)
|
||||
controlP5.Chart : Chart push(float)
|
||||
controlP5.Chart : Chart removeData(ChartData)
|
||||
controlP5.Chart : Chart removeData(String, ChartData)
|
||||
controlP5.Chart : Chart removeData(String, int)
|
||||
controlP5.Chart : Chart removeData(int)
|
||||
controlP5.Chart : Chart removeDataSet(String)
|
||||
controlP5.Chart : Chart removeFirst()
|
||||
controlP5.Chart : Chart removeFirst(String)
|
||||
controlP5.Chart : Chart removeLast()
|
||||
controlP5.Chart : Chart removeLast(String)
|
||||
controlP5.Chart : Chart setData(String, int, ChartData)
|
||||
controlP5.Chart : Chart setData(int, ChartData)
|
||||
controlP5.Chart : Chart setDataSet(ChartDataSet)
|
||||
controlP5.Chart : Chart setDataSet(String, ChartDataSet)
|
||||
controlP5.Chart : Chart setRange(float, float)
|
||||
controlP5.Chart : Chart setResolution(int)
|
||||
controlP5.Chart : Chart setStrokeWeight(float)
|
||||
controlP5.Chart : Chart setValue(float)
|
||||
controlP5.Chart : Chart setView(int)
|
||||
controlP5.Chart : Chart unshift(String, float)
|
||||
controlP5.Chart : Chart unshift(float)
|
||||
controlP5.Chart : ChartData getData(String, int)
|
||||
controlP5.Chart : ChartDataSet getDataSet(String)
|
||||
controlP5.Chart : LinkedHashMap getDataSet()
|
||||
controlP5.Chart : String getInfo()
|
||||
controlP5.Chart : String toString()
|
||||
controlP5.Chart : float getStrokeWeight()
|
||||
controlP5.Chart : float[] getValuesFrom(String)
|
||||
controlP5.Chart : int getResolution()
|
||||
controlP5.Chart : int size()
|
||||
controlP5.Chart : void onEnter()
|
||||
controlP5.Chart : void onLeave()
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : Chart addCallback(CallbackListener)
|
||||
controlP5.Controller : Chart addListener(ControlListener)
|
||||
controlP5.Controller : Chart addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Chart align(int, int, int, int)
|
||||
controlP5.Controller : Chart bringToFront()
|
||||
controlP5.Controller : Chart bringToFront(ControllerInterface)
|
||||
controlP5.Controller : Chart hide()
|
||||
controlP5.Controller : Chart linebreak()
|
||||
controlP5.Controller : Chart listen(boolean)
|
||||
controlP5.Controller : Chart lock()
|
||||
controlP5.Controller : Chart onChange(CallbackListener)
|
||||
controlP5.Controller : Chart onClick(CallbackListener)
|
||||
controlP5.Controller : Chart onDoublePress(CallbackListener)
|
||||
controlP5.Controller : Chart onDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onDraw(ControllerView)
|
||||
controlP5.Controller : Chart onEndDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onEnter(CallbackListener)
|
||||
controlP5.Controller : Chart onLeave(CallbackListener)
|
||||
controlP5.Controller : Chart onMove(CallbackListener)
|
||||
controlP5.Controller : Chart onPress(CallbackListener)
|
||||
controlP5.Controller : Chart onRelease(CallbackListener)
|
||||
controlP5.Controller : Chart onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : Chart onStartDrag(CallbackListener)
|
||||
controlP5.Controller : Chart onWheel(CallbackListener)
|
||||
controlP5.Controller : Chart plugTo(Object)
|
||||
controlP5.Controller : Chart plugTo(Object, String)
|
||||
controlP5.Controller : Chart plugTo(Object[])
|
||||
controlP5.Controller : Chart plugTo(Object[], String)
|
||||
controlP5.Controller : Chart registerProperty(String)
|
||||
controlP5.Controller : Chart registerProperty(String, String)
|
||||
controlP5.Controller : Chart registerTooltip(String)
|
||||
controlP5.Controller : Chart removeBehavior()
|
||||
controlP5.Controller : Chart removeCallback()
|
||||
controlP5.Controller : Chart removeCallback(CallbackListener)
|
||||
controlP5.Controller : Chart removeListener(ControlListener)
|
||||
controlP5.Controller : Chart removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : Chart removeListenersFor(int)
|
||||
controlP5.Controller : Chart removeProperty(String)
|
||||
controlP5.Controller : Chart removeProperty(String, String)
|
||||
controlP5.Controller : Chart setArrayValue(float[])
|
||||
controlP5.Controller : Chart setArrayValue(int, float)
|
||||
controlP5.Controller : Chart setBehavior(ControlBehavior)
|
||||
controlP5.Controller : Chart setBroadcast(boolean)
|
||||
controlP5.Controller : Chart setCaptionLabel(String)
|
||||
controlP5.Controller : Chart setColor(CColor)
|
||||
controlP5.Controller : Chart setColorActive(int)
|
||||
controlP5.Controller : Chart setColorBackground(int)
|
||||
controlP5.Controller : Chart setColorCaptionLabel(int)
|
||||
controlP5.Controller : Chart setColorForeground(int)
|
||||
controlP5.Controller : Chart setColorLabel(int)
|
||||
controlP5.Controller : Chart setColorValue(int)
|
||||
controlP5.Controller : Chart setColorValueLabel(int)
|
||||
controlP5.Controller : Chart setDecimalPrecision(int)
|
||||
controlP5.Controller : Chart setDefaultValue(float)
|
||||
controlP5.Controller : Chart setHeight(int)
|
||||
controlP5.Controller : Chart setId(int)
|
||||
controlP5.Controller : Chart setImage(PImage)
|
||||
controlP5.Controller : Chart setImage(PImage, int)
|
||||
controlP5.Controller : Chart setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : Chart setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : Chart setLabel(String)
|
||||
controlP5.Controller : Chart setLabelVisible(boolean)
|
||||
controlP5.Controller : Chart setLock(boolean)
|
||||
controlP5.Controller : Chart setMax(float)
|
||||
controlP5.Controller : Chart setMin(float)
|
||||
controlP5.Controller : Chart setMouseOver(boolean)
|
||||
controlP5.Controller : Chart setMoveable(boolean)
|
||||
controlP5.Controller : Chart setPosition(float, float)
|
||||
controlP5.Controller : Chart setPosition(float[])
|
||||
controlP5.Controller : Chart setSize(PImage)
|
||||
controlP5.Controller : Chart setSize(int, int)
|
||||
controlP5.Controller : Chart setStringValue(String)
|
||||
controlP5.Controller : Chart setUpdate(boolean)
|
||||
controlP5.Controller : Chart setValue(float)
|
||||
controlP5.Controller : Chart setValueLabel(String)
|
||||
controlP5.Controller : Chart setValueSelf(float)
|
||||
controlP5.Controller : Chart setView(ControllerView)
|
||||
controlP5.Controller : Chart setVisible(boolean)
|
||||
controlP5.Controller : Chart setWidth(int)
|
||||
controlP5.Controller : Chart show()
|
||||
controlP5.Controller : Chart unlock()
|
||||
controlP5.Controller : Chart unplugFrom(Object)
|
||||
controlP5.Controller : Chart unplugFrom(Object[])
|
||||
controlP5.Controller : Chart unregisterTooltip()
|
||||
controlP5.Controller : Chart update()
|
||||
controlP5.Controller : Chart updateSize()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2014/08/16 19:11:34
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* ControlP5 Println
|
||||
*
|
||||
*
|
||||
* a console like textarea which captures the output from the System.out stream
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Textarea myTextarea;
|
||||
|
||||
int c = 0;
|
||||
|
||||
Println console;
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.enableShortcuts();
|
||||
frameRate(50);
|
||||
myTextarea = cp5.addTextarea("txt")
|
||||
.setPosition(100, 100)
|
||||
.setSize(200, 200)
|
||||
.setFont(createFont("", 10))
|
||||
.setLineHeight(14)
|
||||
.setColor(color(200))
|
||||
.setColorBackground(color(0, 100))
|
||||
.setColorForeground(color(255, 100));
|
||||
;
|
||||
|
||||
console = cp5.addConsole(myTextarea);//
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(128);
|
||||
noStroke();
|
||||
ellipseMode(CENTER);
|
||||
float n = sin(frameCount*0.01)*300;
|
||||
fill(110, 255,220);
|
||||
ellipse(width/2, height/2, n , n);
|
||||
|
||||
println(frameCount+"\t"+String.format("%.2f", frameRate)+"\t"+String.format("%.2f", n));
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):
|
||||
console.pause();
|
||||
break;
|
||||
case('2'):
|
||||
console.play();
|
||||
break;
|
||||
case('3'):
|
||||
console.setMax(8);
|
||||
break;
|
||||
case('4'):
|
||||
console.setMax(-1);
|
||||
break;
|
||||
case('5'):
|
||||
console.clear();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* ControlP5 Controller on top of 3D
|
||||
* demonstrates how to use controlP5 controllers on top of a
|
||||
* OpenGL 3D scene.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlP5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
ControlGroup messageBox;
|
||||
int messageBoxResult = -1;
|
||||
String messageBoxString = "";
|
||||
float t;
|
||||
|
||||
void setup() {
|
||||
size(640,480,P3D);
|
||||
cp5 = new ControlP5(this);
|
||||
noStroke();
|
||||
createMessageBox();
|
||||
Button b = cp5.addButton("toggleBox",1,20,20,100,20);
|
||||
b.setLabel("Toggle Box");
|
||||
textFont(createFont("",30));
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
hint(ENABLE_DEPTH_TEST);
|
||||
pushMatrix();
|
||||
if(messageBox.isVisible()) {
|
||||
background(128);
|
||||
} else {
|
||||
background(0);
|
||||
fill(255);
|
||||
text(messageBoxString,20,height-40);
|
||||
}
|
||||
|
||||
translate(width/2,height/2,mouseX);
|
||||
rotateY(t+=0.1);
|
||||
fill(255);
|
||||
rect(-50,-50,100,100);
|
||||
popMatrix();
|
||||
hint(DISABLE_DEPTH_TEST);
|
||||
// in case yo uare using the camera or you have
|
||||
// changed the default camera setting, reset the camera
|
||||
// to default by uncommenting the following line.
|
||||
// camera();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void toggleBox(int theValue) {
|
||||
if(messageBox.isVisible()) {
|
||||
messageBox.hide();
|
||||
} else {
|
||||
messageBox.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void createMessageBox() {
|
||||
// create a group to store the messageBox elements
|
||||
messageBox = cp5.addGroup("messageBox",width/2 - 150,100,300);
|
||||
messageBox.setBackgroundHeight(120);
|
||||
messageBox.setBackgroundColor(color(0,100));
|
||||
messageBox.hideBar();
|
||||
|
||||
// add a TextLabel to the messageBox.
|
||||
Textlabel l = cp5.addTextlabel("messageBoxLabel","Some MessageBox text goes here.",20,20);
|
||||
l.moveTo(messageBox);
|
||||
|
||||
// add a textfield-controller with named-id inputbox
|
||||
// this controller will be linked to function inputbox() below.
|
||||
Textfield f = cp5.addTextfield("inputbox",20,36,260,20);
|
||||
f.getCaptionLabel().setVisible(false);
|
||||
f.moveTo(messageBox);
|
||||
f.setColorForeground(color(20));
|
||||
f.setColorBackground(color(20));
|
||||
f.setColorActive(color(100));
|
||||
// add the OK button to the messageBox.
|
||||
// the name of the button corresponds to function buttonOK
|
||||
// below and will be triggered when pressing the button.
|
||||
Button b1 = cp5.addButton("buttonOK",0,65,80,80,24);
|
||||
b1.moveTo(messageBox);
|
||||
b1.setColorBackground(color(40));
|
||||
b1.setColorActive(color(20));
|
||||
// by default setValue would trigger function buttonOK,
|
||||
// therefore we disable the broadcasting before setting
|
||||
// the value and enable broadcasting again afterwards.
|
||||
// same applies to the cancel button below.
|
||||
b1.setBroadcast(false);
|
||||
b1.setValue(1);
|
||||
b1.setBroadcast(true);
|
||||
b1.setCaptionLabel("OK");
|
||||
// centering of a label needs to be done manually
|
||||
// with marginTop and marginLeft
|
||||
//b1.captionLabel().style().marginTop = -2;
|
||||
//b1.captionLabel().style().marginLeft = 26;
|
||||
|
||||
// add the Cancel button to the messageBox.
|
||||
// the name of the button corresponds to function buttonCancel
|
||||
// below and will be triggered when pressing the button.
|
||||
Button b2 = cp5.addButton("buttonCancel",0,155,80,80,24);
|
||||
b2.moveTo(messageBox);
|
||||
b2.setBroadcast(false);
|
||||
b2.setValue(0);
|
||||
b2.setBroadcast(true);
|
||||
b2.setCaptionLabel("Cancel");
|
||||
b2.setColorBackground(color(40));
|
||||
b2.setColorActive(color(20));
|
||||
//b2.captionLabel().toUpperCase(false);
|
||||
// centering of a label needs to be done manually
|
||||
// with marginTop and marginLeft
|
||||
//b2.captionLabel().style().marginTop = -2;
|
||||
//b2.captionLabel().style().marginLeft = 16;
|
||||
}
|
||||
|
||||
// function buttonOK will be triggered when pressing
|
||||
// the OK button of the messageBox.
|
||||
void buttonOK(int theValue) {
|
||||
println("a button event from button OK.");
|
||||
messageBoxString = ((Textfield)cp5.getController("inputbox")).getText();
|
||||
messageBoxResult = theValue;
|
||||
messageBox.hide();
|
||||
}
|
||||
|
||||
|
||||
// function buttonCancel will be triggered when pressing
|
||||
// the Cancel button of the messageBox.
|
||||
void buttonCancel(int theValue) {
|
||||
println("a button event from button Cancel.");
|
||||
messageBoxResult = theValue;
|
||||
messageBox.hide();
|
||||
}
|
||||
|
||||
// inputbox is called whenever RETURN has been pressed
|
||||
// in textfield-controller inputbox
|
||||
void inputbox(String theString) {
|
||||
println("got something from the inputbox : "+theString);
|
||||
messageBoxString = theString;
|
||||
messageBox.hide();
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/**
|
||||
* ControlP5 Controlframe
|
||||
* with controlP5 2.0 all java.awt dependencies have been removed
|
||||
* as a consequence the option to display controllers in a separate
|
||||
* window had to be removed as well.
|
||||
* this example shows you how to create a java.awt.frame and use controlP5
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import java.awt.Frame;
|
||||
import java.awt.BorderLayout;
|
||||
import controlP5.*;
|
||||
|
||||
private ControlP5 cp5;
|
||||
|
||||
ControlFrame cf;
|
||||
|
||||
int def;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// by calling function addControlFrame() a
|
||||
// new frame is created and an instance of class
|
||||
// ControlFrame is instanziated.
|
||||
cf = addControlFrame("extra", 200,200);
|
||||
|
||||
// add Controllers to the 'extra' Frame inside
|
||||
// the ControlFrame class setup() method below.
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(def);
|
||||
}
|
||||
|
||||
ControlFrame addControlFrame(String theName, int theWidth, int theHeight) {
|
||||
Frame f = new Frame(theName);
|
||||
ControlFrame p = new ControlFrame(this, theWidth, theHeight);
|
||||
f.add(p);
|
||||
p.init();
|
||||
f.setTitle(theName);
|
||||
f.setSize(p.w, p.h);
|
||||
f.setLocation(100, 100);
|
||||
f.setResizable(false);
|
||||
f.setVisible(true);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// the ControlFrame class extends PApplet, so we
|
||||
// are creating a new processing applet inside a
|
||||
// new frame with a controlP5 object loaded
|
||||
public class ControlFrame extends PApplet {
|
||||
|
||||
int w, h;
|
||||
|
||||
int abc = 100;
|
||||
|
||||
public void setup() {
|
||||
size(w, h);
|
||||
frameRate(25);
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addSlider("abc").setRange(0, 255).setPosition(10,10);
|
||||
cp5.addSlider("def").plugTo(parent,"def").setRange(0, 255).setPosition(10,30);
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
background(abc);
|
||||
}
|
||||
|
||||
private ControlFrame() {
|
||||
}
|
||||
|
||||
public ControlFrame(Object theParent, int theWidth, int theHeight) {
|
||||
parent = theParent;
|
||||
w = theWidth;
|
||||
h = theHeight;
|
||||
}
|
||||
|
||||
|
||||
public ControlP5 control() {
|
||||
return cp5;
|
||||
}
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Object parent;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,199 @@
|
|||
/**
|
||||
* ControlP5 FrameRate
|
||||
*
|
||||
*
|
||||
* uses a textlabel to display the current or average
|
||||
* framerate of the sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400,500);
|
||||
frameRate(60);
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addFrameRate().setInterval(10).setPosition(0,height - 10);
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(129);
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the FrameRate Controller
|
||||
use ControlP5.printPublicMethodsFor(FrameRate.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class FrameRate in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.Controller : CColor getColor()
|
||||
controlP5.Controller : ControlBehavior getBehavior()
|
||||
controlP5.Controller : ControlWindow getControlWindow()
|
||||
controlP5.Controller : ControlWindow getWindow()
|
||||
controlP5.Controller : ControllerProperty getProperty(String)
|
||||
controlP5.Controller : ControllerProperty getProperty(String, String)
|
||||
controlP5.Controller : ControllerView getView()
|
||||
controlP5.Controller : FrameRate addCallback(CallbackListener)
|
||||
controlP5.Controller : FrameRate addListener(ControlListener)
|
||||
controlP5.Controller : FrameRate addListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : FrameRate align(int, int, int, int)
|
||||
controlP5.Controller : FrameRate bringToFront()
|
||||
controlP5.Controller : FrameRate bringToFront(ControllerInterface)
|
||||
controlP5.Controller : FrameRate hide()
|
||||
controlP5.Controller : FrameRate linebreak()
|
||||
controlP5.Controller : FrameRate listen(boolean)
|
||||
controlP5.Controller : FrameRate lock()
|
||||
controlP5.Controller : FrameRate onChange(CallbackListener)
|
||||
controlP5.Controller : FrameRate onClick(CallbackListener)
|
||||
controlP5.Controller : FrameRate onDoublePress(CallbackListener)
|
||||
controlP5.Controller : FrameRate onDrag(CallbackListener)
|
||||
controlP5.Controller : FrameRate onDraw(ControllerView)
|
||||
controlP5.Controller : FrameRate onEndDrag(CallbackListener)
|
||||
controlP5.Controller : FrameRate onEnter(CallbackListener)
|
||||
controlP5.Controller : FrameRate onLeave(CallbackListener)
|
||||
controlP5.Controller : FrameRate onMove(CallbackListener)
|
||||
controlP5.Controller : FrameRate onPress(CallbackListener)
|
||||
controlP5.Controller : FrameRate onRelease(CallbackListener)
|
||||
controlP5.Controller : FrameRate onReleaseOutside(CallbackListener)
|
||||
controlP5.Controller : FrameRate onStartDrag(CallbackListener)
|
||||
controlP5.Controller : FrameRate onWheel(CallbackListener)
|
||||
controlP5.Controller : FrameRate plugTo(Object)
|
||||
controlP5.Controller : FrameRate plugTo(Object, String)
|
||||
controlP5.Controller : FrameRate plugTo(Object[])
|
||||
controlP5.Controller : FrameRate plugTo(Object[], String)
|
||||
controlP5.Controller : FrameRate registerProperty(String)
|
||||
controlP5.Controller : FrameRate registerProperty(String, String)
|
||||
controlP5.Controller : FrameRate registerTooltip(String)
|
||||
controlP5.Controller : FrameRate removeBehavior()
|
||||
controlP5.Controller : FrameRate removeCallback()
|
||||
controlP5.Controller : FrameRate removeCallback(CallbackListener)
|
||||
controlP5.Controller : FrameRate removeListener(ControlListener)
|
||||
controlP5.Controller : FrameRate removeListenerFor(int, CallbackListener)
|
||||
controlP5.Controller : FrameRate removeListenersFor(int)
|
||||
controlP5.Controller : FrameRate removeProperty(String)
|
||||
controlP5.Controller : FrameRate removeProperty(String, String)
|
||||
controlP5.Controller : FrameRate setArrayValue(float[])
|
||||
controlP5.Controller : FrameRate setArrayValue(int, float)
|
||||
controlP5.Controller : FrameRate setBehavior(ControlBehavior)
|
||||
controlP5.Controller : FrameRate setBroadcast(boolean)
|
||||
controlP5.Controller : FrameRate setCaptionLabel(String)
|
||||
controlP5.Controller : FrameRate setColor(CColor)
|
||||
controlP5.Controller : FrameRate setColorActive(int)
|
||||
controlP5.Controller : FrameRate setColorBackground(int)
|
||||
controlP5.Controller : FrameRate setColorCaptionLabel(int)
|
||||
controlP5.Controller : FrameRate setColorForeground(int)
|
||||
controlP5.Controller : FrameRate setColorLabel(int)
|
||||
controlP5.Controller : FrameRate setColorValue(int)
|
||||
controlP5.Controller : FrameRate setColorValueLabel(int)
|
||||
controlP5.Controller : FrameRate setDecimalPrecision(int)
|
||||
controlP5.Controller : FrameRate setDefaultValue(float)
|
||||
controlP5.Controller : FrameRate setHeight(int)
|
||||
controlP5.Controller : FrameRate setId(int)
|
||||
controlP5.Controller : FrameRate setImage(PImage)
|
||||
controlP5.Controller : FrameRate setImage(PImage, int)
|
||||
controlP5.Controller : FrameRate setImages(PImage, PImage, PImage)
|
||||
controlP5.Controller : FrameRate setImages(PImage, PImage, PImage, PImage)
|
||||
controlP5.Controller : FrameRate setLabel(String)
|
||||
controlP5.Controller : FrameRate setLabelVisible(boolean)
|
||||
controlP5.Controller : FrameRate setLock(boolean)
|
||||
controlP5.Controller : FrameRate setMax(float)
|
||||
controlP5.Controller : FrameRate setMin(float)
|
||||
controlP5.Controller : FrameRate setMouseOver(boolean)
|
||||
controlP5.Controller : FrameRate setMoveable(boolean)
|
||||
controlP5.Controller : FrameRate setPosition(float, float)
|
||||
controlP5.Controller : FrameRate setPosition(float[])
|
||||
controlP5.Controller : FrameRate setSize(PImage)
|
||||
controlP5.Controller : FrameRate setSize(int, int)
|
||||
controlP5.Controller : FrameRate setStringValue(String)
|
||||
controlP5.Controller : FrameRate setUpdate(boolean)
|
||||
controlP5.Controller : FrameRate setValue(float)
|
||||
controlP5.Controller : FrameRate setValueLabel(String)
|
||||
controlP5.Controller : FrameRate setValueSelf(float)
|
||||
controlP5.Controller : FrameRate setView(ControllerView)
|
||||
controlP5.Controller : FrameRate setVisible(boolean)
|
||||
controlP5.Controller : FrameRate setWidth(int)
|
||||
controlP5.Controller : FrameRate show()
|
||||
controlP5.Controller : FrameRate unlock()
|
||||
controlP5.Controller : FrameRate unplugFrom(Object)
|
||||
controlP5.Controller : FrameRate unplugFrom(Object[])
|
||||
controlP5.Controller : FrameRate unregisterTooltip()
|
||||
controlP5.Controller : FrameRate update()
|
||||
controlP5.Controller : FrameRate updateSize()
|
||||
controlP5.Controller : Label getCaptionLabel()
|
||||
controlP5.Controller : Label getValueLabel()
|
||||
controlP5.Controller : List getControllerPlugList()
|
||||
controlP5.Controller : Pointer getPointer()
|
||||
controlP5.Controller : String getAddress()
|
||||
controlP5.Controller : String getInfo()
|
||||
controlP5.Controller : String getName()
|
||||
controlP5.Controller : String getStringValue()
|
||||
controlP5.Controller : String toString()
|
||||
controlP5.Controller : Tab getTab()
|
||||
controlP5.Controller : boolean isActive()
|
||||
controlP5.Controller : boolean isBroadcast()
|
||||
controlP5.Controller : boolean isInside()
|
||||
controlP5.Controller : boolean isLabelVisible()
|
||||
controlP5.Controller : boolean isListening()
|
||||
controlP5.Controller : boolean isLock()
|
||||
controlP5.Controller : boolean isMouseOver()
|
||||
controlP5.Controller : boolean isMousePressed()
|
||||
controlP5.Controller : boolean isMoveable()
|
||||
controlP5.Controller : boolean isUpdate()
|
||||
controlP5.Controller : boolean isVisible()
|
||||
controlP5.Controller : float getArrayValue(int)
|
||||
controlP5.Controller : float getDefaultValue()
|
||||
controlP5.Controller : float getMax()
|
||||
controlP5.Controller : float getMin()
|
||||
controlP5.Controller : float getValue()
|
||||
controlP5.Controller : float[] getAbsolutePosition()
|
||||
controlP5.Controller : float[] getArrayValue()
|
||||
controlP5.Controller : float[] getPosition()
|
||||
controlP5.Controller : int getDecimalPrecision()
|
||||
controlP5.Controller : int getHeight()
|
||||
controlP5.Controller : int getId()
|
||||
controlP5.Controller : int getWidth()
|
||||
controlP5.Controller : int listenerSize()
|
||||
controlP5.Controller : void remove()
|
||||
controlP5.Controller : void setView(ControllerView, int)
|
||||
controlP5.FrameRate : FrameRate setInterval(int)
|
||||
controlP5.FrameRate : void draw(PGraphics)
|
||||
controlP5.Textlabel : ControllerStyle getStyle()
|
||||
controlP5.Textlabel : Label get()
|
||||
controlP5.Textlabel : Textlabel append(String, int)
|
||||
controlP5.Textlabel : Textlabel setColor(int)
|
||||
controlP5.Textlabel : Textlabel setFont(ControlFont)
|
||||
controlP5.Textlabel : Textlabel setFont(PFont)
|
||||
controlP5.Textlabel : Textlabel setHeight(int)
|
||||
controlP5.Textlabel : Textlabel setLetterSpacing(int)
|
||||
controlP5.Textlabel : Textlabel setLineHeight(int)
|
||||
controlP5.Textlabel : Textlabel setMultiline(boolean)
|
||||
controlP5.Textlabel : Textlabel setStringValue(String)
|
||||
controlP5.Textlabel : Textlabel setText(String)
|
||||
controlP5.Textlabel : Textlabel setValue(String)
|
||||
controlP5.Textlabel : Textlabel setValue(float)
|
||||
controlP5.Textlabel : Textlabel setWidth(int)
|
||||
controlP5.Textlabel : int getLineHeight()
|
||||
controlP5.Textlabel : void draw()
|
||||
controlP5.Textlabel : void draw(PApplet)
|
||||
controlP5.Textlabel : void draw(PGraphics)
|
||||
controlP5.Textlabel : void draw(int, int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:22:02
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import controlP5.*;
|
||||
|
||||
private ControlP5 cp5;
|
||||
|
||||
ControlFrame cf1, cf2;
|
||||
|
||||
int bgColor;
|
||||
|
||||
void setup() {
|
||||
size(400, 400 ,P3D );
|
||||
/* add a controlP5 instance for the main sketch window (not required for other ControlFrames to work) */
|
||||
cp5 = new ControlP5( this );
|
||||
cp5.addSlider( "s2" );
|
||||
|
||||
|
||||
/* Add a controlframe */
|
||||
|
||||
cf1 = addControlFrame( "hello", 200, 200, 20, 20, color( 100 ) );
|
||||
|
||||
// add a slider with an EventListener. When dragging the slider,
|
||||
// variable bgColor will change accordingly.
|
||||
cf1.control().addSlider( "s1" ).setRange( 0, 255 ).addListener( new ControlListener() {
|
||||
public void controlEvent( ControlEvent ev ) {
|
||||
bgColor = color( ev.getValue() );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
/* Add a second controlframe */
|
||||
|
||||
cf2 = addControlFrame( "world", 200, 200, 20, 240, color( 100 ) );
|
||||
|
||||
// add a button with an EventListener. When releasing the button,
|
||||
// variable bgColor will change to color( 255 );
|
||||
cf2.control().addButton( "b1" ).addListener( new ControlListener() {
|
||||
public void controlEvent( ControlEvent ev ) {
|
||||
bgColor = color( 255 );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
cf2.control().addButton( "b2" ).addListener( new ControlListener() {
|
||||
public void controlEvent(ControlEvent ev) {
|
||||
bgColor = color( random( 255 ), random( 255 ), random( 255 ) );
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background( bgColor );
|
||||
}
|
||||
|
||||
|
||||
/* no changes required below */
|
||||
|
||||
|
||||
ControlFrame addControlFrame(String theName, int theWidth, int theHeight) {
|
||||
return addControlFrame(theName, theWidth, theHeight, 100, 100, color( 0 ) );
|
||||
}
|
||||
|
||||
ControlFrame addControlFrame(String theName, int theWidth, int theHeight, int theX, int theY, int theColor ) {
|
||||
final Frame f = new Frame( theName );
|
||||
final ControlFrame p = new ControlFrame( this, theWidth, theHeight, theColor );
|
||||
|
||||
f.add( p );
|
||||
p.init();
|
||||
f.setTitle(theName);
|
||||
f.setSize( p.w, p.h );
|
||||
f.setLocation( theX, theY );
|
||||
f.addWindowListener( new WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(WindowEvent we) {
|
||||
p.dispose();
|
||||
f.dispose();
|
||||
}
|
||||
}
|
||||
);
|
||||
f.setResizable( false );
|
||||
f.setVisible( true );
|
||||
// sleep a little bit to allow p to call setup.
|
||||
// otherwise a nullpointerexception might be caused.
|
||||
try {
|
||||
Thread.sleep( 100 );
|
||||
}
|
||||
catch(Exception e) {
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
// the ControlFrame class extends PApplet, so we
|
||||
// are creating a new processing applet inside a
|
||||
// new frame with a controlP5 object loaded
|
||||
public class ControlFrame extends PApplet {
|
||||
|
||||
int w, h;
|
||||
|
||||
int bg;
|
||||
|
||||
public void setup() {
|
||||
size(w, h);
|
||||
frameRate(25);
|
||||
cp5 = new ControlP5( this );
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
background( bg );
|
||||
}
|
||||
|
||||
private ControlFrame() {
|
||||
}
|
||||
|
||||
public ControlFrame(Object theParent, int theWidth, int theHeight, int theColor) {
|
||||
parent = theParent;
|
||||
w = theWidth;
|
||||
h = theHeight;
|
||||
bg = theColor;
|
||||
}
|
||||
|
||||
|
||||
public ControlP5 control() {
|
||||
return this.cp5;
|
||||
}
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
Object parent;
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* ControlP5 Canvas
|
||||
*
|
||||
* by andreas schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400,600);
|
||||
smooth();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addGroup("myGroup")
|
||||
.setLabel("Testing Canvas")
|
||||
.setPosition(100,200)
|
||||
.setWidth(200)
|
||||
.addCanvas(new TestCanvas())
|
||||
;
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
||||
class TestCanvas extends Canvas {
|
||||
|
||||
float n;
|
||||
float a;
|
||||
|
||||
public void setup(PGraphics pg) {
|
||||
println("starting a test canvas.");
|
||||
n = 1;
|
||||
}
|
||||
public void draw(PGraphics pg) {
|
||||
n += 0.01;
|
||||
pg.ellipseMode(CENTER);
|
||||
pg.fill(lerpColor(color(0,100,200),color(0,200,100),map(sin(n),-1,1,0,1)));
|
||||
pg.rect(0,0,200,200);
|
||||
pg.fill(255,150);
|
||||
a+=0.01;
|
||||
ellipse(100,100,abs(sin(a)*150),abs(sin(a)*150));
|
||||
ellipse(40,40,abs(sin(a+0.5)*50),abs(sin(a+0.5)*50));
|
||||
ellipse(60,140,abs(cos(a)*80),abs(cos(a)*80));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColor = color(0);
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400,600);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// replace the default controlP5 button with an image.
|
||||
// button.setImages(defaultImage, rolloverImage, pressedImage);
|
||||
// use button.updateSize() to adjust the size of the button and
|
||||
// resize to the dimensions of the defaultImage
|
||||
|
||||
cp5.addButton("buttonA")
|
||||
.setPosition(175,275)
|
||||
.setImages(loadImage("Arrow-Left.png"), loadImage("Arrow-Right.png"), loadImage("Refresh.png"))
|
||||
.updateSize();
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColor);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println(theEvent.getController().getName());
|
||||
|
||||
}
|
||||
|
||||
// function buttonA will receive changes from
|
||||
// controller with name buttonA
|
||||
public void buttonA(int theValue) {
|
||||
println("a button event from buttonA: "+theValue);
|
||||
myColor = color(128);
|
||||
}
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,50 @@
|
|||
/**
|
||||
* ControlP5 ControlKey
|
||||
* use ControlKeys to map key combinations to particular events.
|
||||
* multi-keypress supported.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int col;
|
||||
int colEllipse;
|
||||
boolean visible;
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
smooth();
|
||||
noStroke();
|
||||
col = color(0);
|
||||
colEllipse = color(0,255,90);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// press key 1 to change background to white
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(255);}}, '1');
|
||||
|
||||
// press key 2 to change background to black
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {col = color(0);}}, '2');
|
||||
|
||||
// press key 1 and ALT to make circles visible
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = true;}}, ALT,'1');
|
||||
|
||||
// press key 2 and ALT to hide circles
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {visible = false;}}, ALT,'2');
|
||||
|
||||
// press key 1 and ALT and SHIFT to change the color of circles
|
||||
cp5.mapKeyFor(new ControlKey() {public void keyEvent() {colEllipse = color(random(255));}}, ALT,'1',SHIFT);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(col);
|
||||
if(visible) {
|
||||
fill(colEllipse);
|
||||
ellipse(100,100,50,50);
|
||||
ellipse(150,400,200,200);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
import controlP5.*;
|
||||
|
||||
String[][] s = new String[3][];
|
||||
ControlP5 controlP5;
|
||||
ListBox l;
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
controlP5 = new ControlP5(this);
|
||||
l = controlP5.addListBox("myList",100,100,120,150);
|
||||
// l.actAsPulldownMenu(true);
|
||||
l.setItemHeight(23);
|
||||
|
||||
|
||||
s[0] = new String[] {
|
||||
"a","b","c","d"
|
||||
};
|
||||
s[1] = new String[] {
|
||||
"a","b","c","d","e","f","g","h","i","j","k","l","m","n"
|
||||
};
|
||||
s[2] = new String[] {
|
||||
"l","m","n"
|
||||
};
|
||||
|
||||
for(int i=0;i<s[1].length;i++) {
|
||||
l.addItem(s[1][i],i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
|
||||
switch(key) {
|
||||
case('1'):
|
||||
println("changing list to items of group 1");
|
||||
l.clear();
|
||||
for(int i=0;i<s[0].length;i++) {
|
||||
// using bit shifting to store 2 values in 1 int
|
||||
int n = 0;
|
||||
n = n | 1 << 8;
|
||||
n = n | i << 0;
|
||||
l.addItem("1-"+s[0][i],n);
|
||||
}
|
||||
break;
|
||||
case('2'):
|
||||
println("changing list to items of group 2");
|
||||
l.clear();
|
||||
for(int i=0;i<s[1].length;i++) {
|
||||
// useing bit shifting to store 2 values in 1 int
|
||||
int n = 0;
|
||||
n = n | 2 << 8;
|
||||
n = n | i << 0;
|
||||
l.addItem("2-"+s[1][i],n);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void myList(int theValue) {
|
||||
println("from myList "+theValue);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if(theEvent.isGroup()) {
|
||||
print("> "+theEvent.getGroup().getValue());
|
||||
int n = int(theEvent.getGroup().getValue());
|
||||
println("\t\t group:"+(n >> 8 & 0xff)+", item:"+(n >> 0 & 0xff));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* ControlP5 KeyEventAndWheel
|
||||
*
|
||||
* with controlP5 2.0 all java.awt dependencies have been removed
|
||||
* as a consequence the option to use the MouseWheel for some controllers
|
||||
* has been removed. But the following example shows how to manually add
|
||||
* the mouseWheel support.
|
||||
*
|
||||
* With early versions of the processing 2.0 beta releases the keyEvent forwarding
|
||||
* does not work as expected and needs to be forwarded manually.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
import java.util.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(700, 300);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
|
||||
cp5.addNumberbox("numberbox")
|
||||
.setPosition(20, 20)
|
||||
.setSize(100, 20)
|
||||
;
|
||||
|
||||
cp5.addSlider("slider")
|
||||
.setPosition(20, 70)
|
||||
.setSize(200, 20)
|
||||
;
|
||||
|
||||
cp5.addKnob("knob")
|
||||
.setPosition(20, 120)
|
||||
.setRadius(50)
|
||||
;
|
||||
|
||||
List<String> drops = new ArrayList<String>();
|
||||
for(int i=0;i<100;i++) {
|
||||
drops.add("item "+i);
|
||||
}
|
||||
|
||||
cp5.addDropdownList("drop")
|
||||
.setPosition(300, 30)
|
||||
.setWidth(200)
|
||||
.addItems(drops)
|
||||
;
|
||||
|
||||
cp5.addListBox("list")
|
||||
.setPosition(520, 30)
|
||||
.setSize(150,200)
|
||||
.addItems(drops)
|
||||
;
|
||||
|
||||
cp5.addTextarea("area")
|
||||
.setPosition(300, 150)
|
||||
.setSize(200,100)
|
||||
.setLineHeight(10)
|
||||
.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam feugiat porttitor tempus. Donec hendrerit aliquam mauris, a interdum ante pellentesque et. In dui erat, condimentum et sodales eget, scelerisque quis libero. Nam non nibh vitae enim auctor fringilla sit amet quis magna. Quisque ultricies mi at arcu vulputate imperdiet tristique purus adipiscing. Maecenas pretium odio ac leo aliquam id commodo nulla eleifend. Aenean in pharetra mauris. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla suscipit, nisl vitae eleifend tincidunt, dolor justo sollicitudin nunc, sit amet rhoncus odio purus eu purus. Cras bibendum placerat elementum. Donec in lorem libero. Praesent auctor, felis quis volutpat facilisis, neque turpis tempor nisi, interdum viverra enim purus vel mi. Nam faucibus accumsan lorem, convallis consectetur elit vulputate ut.");
|
||||
;
|
||||
// add mousewheel support, now hover the slide with your mouse
|
||||
// and use the mousewheel (or trackpad on a macbook) to change the
|
||||
// value of the slider.
|
||||
addMouseWheelListener();
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent event) {
|
||||
println(event);
|
||||
}
|
||||
|
||||
// When working in desktop mode, you can add mousewheel support for
|
||||
// controlP5 by using java.awt.event.MouseWheelListener and
|
||||
// java.awt.event.MouseWheelEvent
|
||||
|
||||
void addMouseWheelListener() {
|
||||
frame.addMouseWheelListener(new java.awt.event.MouseWheelListener() {
|
||||
public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) {
|
||||
cp5.setMouseWheelRotation(e.getWheelRotation());
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* ControlP5 Pointer
|
||||
*
|
||||
* Default mouse actions use the Pointer class to trigger events.
|
||||
* you can manipulate the x and y fields of the Pointer class
|
||||
* for customizing input events for example when using a
|
||||
* different input than the mouse.
|
||||
* Here in this example the mouse coordiates are reveresed.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
// disable outodraw because we want to draw our
|
||||
// custom cursor on to of controlP5
|
||||
cp5.setAutoDraw(false);
|
||||
|
||||
cp5.addSlider("hello", 0, 100, 50, 40, 40, 100, 20);
|
||||
|
||||
// enable the pointer (and disable the mouse as input)
|
||||
cp5.getPointer().enable();
|
||||
cp5.getPointer().set(width/2, height/2);
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(cp5.get("hello").getValue());
|
||||
// first draw controlP5
|
||||
cp5.draw();
|
||||
|
||||
// the draw our pointer
|
||||
cp5.getPointer().set(width - mouseX, height - mouseY);
|
||||
pushMatrix();
|
||||
translate(cp5.getPointer().getX(), cp5.getPointer().getY());
|
||||
stroke(255);
|
||||
line(-10,0,10,0);
|
||||
line(0,-10,0,10);
|
||||
popMatrix();
|
||||
println(cp5.isMouseOver());
|
||||
}
|
||||
|
||||
void mousePressed() {
|
||||
cp5.getPointer().pressed();
|
||||
}
|
||||
|
||||
void mouseReleased() {
|
||||
cp5.getPointer().released();
|
||||
}
|
||||
|
||||
/*
|
||||
a list of all methods available for the Pointer Controller
|
||||
use ControlP5.printPublicMethodsFor(Pointer.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class Pointer in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
|
||||
created: 2015/03/24 12:22:14
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,133 @@
|
|||
/**
|
||||
* ControlP5 properties sets.
|
||||
*
|
||||
* saves/loads controller values into/from properties-file.
|
||||
* this example shows how to make property sets of controllers that can be loaded and
|
||||
* saved individually. By default property files come in a serialized format
|
||||
* with a .ser extension.
|
||||
*
|
||||
*
|
||||
* default properties load/save key combinations are
|
||||
* alt+shift+l to load properties
|
||||
* alt+shift+s to save properties
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the ControllerPropererties Controller
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by andreas schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
public int slider1 = 32;
|
||||
public int slider2 = 64;
|
||||
public int slider3 = 128;
|
||||
public int slider4 = 255;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// add a vertical slider
|
||||
cp5.addSlider("slider1", 0, 255, 20, 100, 128, 20);
|
||||
cp5.addSlider("slider2", 0, 255, 20, 150, 128, 20);
|
||||
cp5.addSlider("slider3", 0, 255, 20, 200, 128, 20);
|
||||
cp5.addSlider("slider4", 0, 255, 20, 250, 128, 20);
|
||||
|
||||
cp5.addButton("b1", 0, 20, 350, 80, 12).setCaptionLabel("save setA");
|
||||
cp5.addButton("b2", 0, 101, 350, 80, 12).setCaptionLabel("load setA").setColorBackground(color(0, 100, 50));
|
||||
|
||||
cp5.addButton("b3", 0, 200, 350, 80, 12).setCaptionLabel("save default");
|
||||
cp5.addButton("b4", 0, 281, 350, 80, 12).setCaptionLabel("load default").setColorBackground(color(0, 100, 50));
|
||||
|
||||
|
||||
// add a new properties set 'setA'
|
||||
cp5.getProperties().addSet("setA");
|
||||
|
||||
// move controller 'slider' from the default set to setA
|
||||
// the 3 parameters read like this: move controller(1) from set(2) to set(3)
|
||||
cp5.getProperties().move(cp5.getController("slider1"), "default", "setA");
|
||||
// use copy instead of move to register 'slider' with both sets (default and setA)
|
||||
|
||||
// prints the current list of properties registered and the set(s) they belong to
|
||||
cp5.getProperties().print();
|
||||
|
||||
/* by default properties are saved in JSON format, if you want to change to the old default (java's serialized format), un-comment line below*/
|
||||
// cp5.getProperties().setFormat(ControlP5.SERIALIZED);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
|
||||
fill(slider1);
|
||||
rect(250, 100, 100, 20);
|
||||
|
||||
fill(slider2);
|
||||
rect(250, 150, 100, 20);
|
||||
|
||||
fill(slider3);
|
||||
rect(250, 200, 100, 20);
|
||||
|
||||
fill(slider4);
|
||||
rect(250, 250, 100, 20);
|
||||
}
|
||||
|
||||
void b1(float v) {
|
||||
cp5.saveProperties("setA", "setA");
|
||||
}
|
||||
|
||||
void b2(float v) {
|
||||
cp5.loadProperties(("setA"));
|
||||
}
|
||||
|
||||
void b3(float v) {
|
||||
cp5.saveProperties("default", "default");
|
||||
}
|
||||
|
||||
void b4(float v) {
|
||||
cp5.loadProperties(("default.json"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControllerProperties class
|
||||
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControllerProperties in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : HashSet addSet(String)
|
||||
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||
controlP5.ControllerProperties : Map get()
|
||||
controlP5.ControllerProperties : String toString()
|
||||
controlP5.ControllerProperties : boolean load()
|
||||
controlP5.ControllerProperties : boolean load(String)
|
||||
controlP5.ControllerProperties : void delete(ControllerProperty)
|
||||
controlP5.ControllerProperties : void move(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : void move(ControllerProperty, String, String)
|
||||
controlP5.ControllerProperties : void only(ControllerProperty, String)
|
||||
controlP5.ControllerProperties : void print()
|
||||
controlP5.ControllerProperties : void setFormat(Format)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
*/
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"/slider3": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 12.750000953674316
|
||||
},
|
||||
"/slider2": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 130.05001831054688
|
||||
},
|
||||
"/slider4": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 214.20004272460938
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
{"/slider1": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 255
|
||||
}}
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* ControlP5 RenderIntoPGraphics
|
||||
*
|
||||
*
|
||||
* experimental
|
||||
*
|
||||
* by Andreas Schlegel, 2013
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 c1 , c2;
|
||||
PGraphics panel1 , panel2;
|
||||
|
||||
void setup() {
|
||||
size( 1024, 500 , P3D ); //
|
||||
panel1 = createGraphics( 200 , height/2 );
|
||||
panel2 = createGraphics( 200 , height/2 );
|
||||
c1 = new ControlP5( this );
|
||||
c1.enableShortcuts();
|
||||
c1.setBackground( color( 0 , 50 ) );
|
||||
c1.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||
c1.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||
c1.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||
c1.setGraphics( panel1 , 0 , 0 );
|
||||
|
||||
c2 = new ControlP5( this );
|
||||
c2.enableShortcuts();
|
||||
c2.setBackground( color( 0 , 50 ) );
|
||||
c2.addButton("hello").setSize(200,20).setPosition( 0 , 0 );
|
||||
c2.addButton("world").setSize(200,100).setPosition( 0 , 70 );
|
||||
c2.addSlider("slider").setSize(50,20).setPosition( 0 , 40 );
|
||||
c2.setGraphics( panel2 , 220 , 0 );
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background( 100 , 0 , 0 );
|
||||
|
||||
/* TODO update mouseevent when using setGraphics */
|
||||
c1.setGraphics( panel1 , 100 + int(sin(frameCount*0.1) * 100) , 250 );
|
||||
}
|
||||
|
||||
|
||||
void controlEvent( ControlEvent ce) {
|
||||
println(ce);
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/**
|
||||
* ControlP5 ControllerStyle
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the ControllerStyle Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
float v1 = 50, v2 = 100, v3 = 100, v4 = 100;
|
||||
|
||||
void setup() {
|
||||
size(400,600);
|
||||
smooth();
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.begin(100,100);
|
||||
cp5.addSlider("v1",0,255).linebreak();
|
||||
cp5.addSlider("v2",0,200).linebreak();
|
||||
cp5.addSlider("v3",0,300).linebreak();
|
||||
cp5.addSlider("v4",0,400);
|
||||
cp5.end();
|
||||
|
||||
// change the caption label for controller v1 and apply styles
|
||||
cp5.getController("v1").setCaptionLabel("Background");
|
||||
style("v1");
|
||||
|
||||
// change the caption label for controller v2 and apply styles
|
||||
cp5.getController("v2").setCaptionLabel("Ellipse A");
|
||||
style("v2");
|
||||
|
||||
// change the caption label for controller v3 and apply styles
|
||||
cp5.getController("v3").setCaptionLabel("Ellipse B");
|
||||
style("v3");
|
||||
|
||||
// change the caption label for controller v3 and apply styles
|
||||
cp5.getController("v4").setCaptionLabel("Ellipse C");
|
||||
style("v4");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void style(String theControllerName) {
|
||||
Controller c = cp5.getController(theControllerName);
|
||||
// adjust the height of the controller
|
||||
c.setHeight(15);
|
||||
|
||||
// add some padding to the caption label background
|
||||
c.getCaptionLabel().getStyle().setPadding(4,4,3,4);
|
||||
|
||||
// shift the caption label up by 4px
|
||||
c.getCaptionLabel().getStyle().setMargin(-4,0,0,0);
|
||||
|
||||
// set the background color of the caption label
|
||||
c.getCaptionLabel().setColorBackground(color(10,20,30,140));
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(v1);
|
||||
fill(255,255,220,100);
|
||||
ellipse(width/2-100, height/2-100,v2 + 50,v2 + 50);
|
||||
ellipse(width/2+100, height/2,v3,v3);
|
||||
ellipse(width/2, height/2+100,v4,v4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControllerStyle Controller
|
||||
use ControlP5.printPublicMethodsFor(ControllerStyle.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControllerStyle in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
|
||||
|
||||
controlP5.ControllerStyle : ControllerStyle margin(int)
|
||||
controlP5.ControllerStyle : ControllerStyle margin(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle moveMargin(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle movePadding(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle padding(int)
|
||||
controlP5.ControllerStyle : ControllerStyle padding(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle setMargin(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle setMarginBottom(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setMarginLeft(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setMarginRight(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setMarginTop(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setPadding(int, int, int, int)
|
||||
controlP5.ControllerStyle : ControllerStyle setPaddingBottom(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setPaddingLeft(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setPaddingRight(int)
|
||||
controlP5.ControllerStyle : ControllerStyle setPaddingTop(int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
* ControlP5 textfield (advanced)
|
||||
*
|
||||
* demonstrates how to use keepFocus, setText, getText, getTextList,
|
||||
* clear, setAutoClear, isAutoClear and submit.
|
||||
*
|
||||
* by andreas schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
String textValue = "";
|
||||
|
||||
Textfield myTextfield;
|
||||
|
||||
void setup() {
|
||||
size(400, 600);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
myTextfield = cp5.addTextfield("textinput")
|
||||
.setPosition(100, 200)
|
||||
.setSize(200, 20)
|
||||
.setFocus(true)
|
||||
;
|
||||
|
||||
cp5.addTextfield("textValue")
|
||||
.setPosition(100, 300)
|
||||
.setSize(200, 20)
|
||||
;
|
||||
|
||||
// use setAutoClear(true/false) to clear a textfield or keep text displayed in
|
||||
// a textfield after pressing return.
|
||||
myTextfield.setAutoClear(true).keepFocus(true);
|
||||
|
||||
cp5.addButton("clear", 0, 20, 200, 70, 20);
|
||||
cp5.addButton("submit", 0, 310, 200, 60, 20);
|
||||
cp5.addButton("performTextfieldActions", 0, 20, 100, 150, 20);
|
||||
cp5.addToggle("toggleAutoClear", true, 180, 100, 90, 20).setCaptionLabel("Auto Clear");
|
||||
cp5.addToggle("toggleKeepFocus", true, 280, 100, 90, 20).setCaptionLabel("Keep Focus");
|
||||
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
void toggleAutoClear(boolean theFlag) {
|
||||
myTextfield.setAutoClear(theFlag);
|
||||
}
|
||||
|
||||
void toggleKeepFocus(boolean theFlag) {
|
||||
myTextfield.keepFocus(theFlag);
|
||||
}
|
||||
|
||||
void clear(int theValue) {
|
||||
myTextfield.clear();
|
||||
}
|
||||
|
||||
void submit(int theValue) {
|
||||
myTextfield.submit();
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
if (theEvent.isAssignableFrom(Textfield.class)) {
|
||||
Textfield t = (Textfield)theEvent.getController();
|
||||
|
||||
println("controlEvent: accessing a string from controller '"
|
||||
+t.getName()+"': "+t.getStringValue()
|
||||
);
|
||||
|
||||
// Textfield.isAutoClear() must be true
|
||||
print("controlEvent: trying to setText, ");
|
||||
|
||||
t.setText("controlEvent: changing text.");
|
||||
if (t.isAutoClear()==false) {
|
||||
println(" success!");
|
||||
}
|
||||
else {
|
||||
println(" but Textfield.isAutoClear() is false, could not setText here.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void performTextfieldActions() {
|
||||
println("\n");
|
||||
// Textfield.getText();
|
||||
println("the current text of myTextfield: "+myTextfield.getText());
|
||||
println("the current value of textValue: "+textValue);
|
||||
// Textfield.setText();
|
||||
myTextfield.setText("changed the text of a textfield");
|
||||
println("changing text of myTextfield to: "+myTextfield.getText());
|
||||
// Textfield.getTextList();
|
||||
println("the textlist of myTextfield has "+myTextfield.getTextList().length+" items.");
|
||||
for (int i=0;i<myTextfield.getTextList().length;i++) {
|
||||
println("\t"+myTextfield.getTextList()[i]);
|
||||
}
|
||||
println("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public void textinput(String theText) {
|
||||
// receiving text from controller textinput
|
||||
println("a textfield event for controller 'textinput': "+theText);
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* ControlP5 with PeasyCam support. tested with peasy 0.8.2
|
||||
*
|
||||
* by jeffg 2011
|
||||
*/
|
||||
|
||||
import peasy.*;
|
||||
import controlP5.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
PeasyCam cam;
|
||||
ControlP5 cp5;
|
||||
|
||||
int buttonValue = 1;
|
||||
|
||||
int myColor = color(255, 0, 0);
|
||||
|
||||
void setup() {
|
||||
size(400, 400, OPENGL);
|
||||
cam = new PeasyCam(this, 100);
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addButton("button", 10, 100, 60, 80, 20).setId(1);
|
||||
cp5.addButton("buttonValue", 4, 100, 90, 80, 20).setId(2);
|
||||
cp5.setAutoDraw(false);
|
||||
}
|
||||
void draw() {
|
||||
|
||||
background(0);
|
||||
fill(myColor);
|
||||
box(30);
|
||||
pushMatrix();
|
||||
translate(0, 0, 20);
|
||||
fill(0, 0, 255);
|
||||
box(5);
|
||||
popMatrix();
|
||||
// makes the gui stay on top of elements
|
||||
// drawn before.
|
||||
|
||||
gui();
|
||||
|
||||
}
|
||||
|
||||
void gui() {
|
||||
hint(DISABLE_DEPTH_TEST);
|
||||
cam.beginHUD();
|
||||
cp5.draw();
|
||||
cam.endHUD();
|
||||
hint(ENABLE_DEPTH_TEST);
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
println(theEvent.getController().getId());
|
||||
}
|
||||
|
||||
void button(float theValue) {
|
||||
myColor = color(random(255), random(255), random(255));
|
||||
println("a button event. "+theValue);
|
||||
}
|
|
@ -0,0 +1,166 @@
|
|||
/**
|
||||
* ControlP5 Annotation
|
||||
*
|
||||
* Lately annotation support has been added to processing.
|
||||
* Making use of annotations to create controllers is a great strategy i learned
|
||||
* from Karsten Schmidt's (toxi) cp5magic library.
|
||||
* Loving the simplicity of annotations and how it is aplied with cp5magic,
|
||||
* i had to include it into controlp5 and the following example
|
||||
* shows how to use annotations with controlp5.
|
||||
*
|
||||
* Annotations can be applied to variables and functions of the main program
|
||||
* as well as individual classes. More details are included in the comments below.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
TestControl tc1, tc2;
|
||||
|
||||
Tab extraTab;
|
||||
|
||||
// create controllers using the ControlElement annotation
|
||||
// by default a slider is created for int and float
|
||||
// values will range from 0-100 by default
|
||||
// default attributes are x,y and label
|
||||
@ControlElement (x=10, y=80)
|
||||
int n = 20;
|
||||
|
||||
// to customize a controller with a CoontrolElement use the
|
||||
// properties attribute. values passed using properties have a key and a value
|
||||
// here the key corresponds with a function found within a controller which
|
||||
// starts with set followed by the name of the key. the value is then applied accordingly.
|
||||
// e.g. min=10 will translate to controller.setMin(10)
|
||||
@ControlElement (properties = { "min=0", "max=255", "type=numberbox", "height=10", "width=50"} , x=10, y=40, label="Change Background")
|
||||
float m = 40;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(600, 400);
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// Annotations:
|
||||
// addControllersFor(PApplet) checks the main sketch for
|
||||
// annotations and adds controllers accordingly.
|
||||
cp5.addControllersFor(this);
|
||||
|
||||
|
||||
|
||||
|
||||
extraTab = cp5.addTab("extra");
|
||||
|
||||
// create an instance of class testControl
|
||||
tc1 = new TestControl();
|
||||
|
||||
// addControllersFor cycles throught object tc1
|
||||
// and assigns controllers according to available annotations.
|
||||
// an address will be assigned to these controllers, in the example
|
||||
// below the address is /world and the individual controllers can be
|
||||
// accessed adding a / and the controller's name
|
||||
// e.g. variable x
|
||||
// /world/x
|
||||
cp5.addControllersFor("world", tc1);
|
||||
|
||||
// set the Position of controllers contained within object tc1
|
||||
cp5.setPosition(10, 150, tc1);
|
||||
|
||||
|
||||
// a more advanced example of using functions with ControllerObjects
|
||||
tc2 = new TestControl();
|
||||
CColor col = new CColor();
|
||||
col.setActive(color(0, 200, 100));
|
||||
|
||||
cp5.addControllersFor("hello", tc2)
|
||||
.setPosition(200, 150, tc2)
|
||||
.moveTo(extraTab, tc2)
|
||||
.setColor(col, tc2);
|
||||
|
||||
cp5.getController("s", tc2)
|
||||
.setStringValue("Second Control");
|
||||
|
||||
// with listening turned on, a controller can listen to changes made to its connected variable
|
||||
// here the controller will listen to variable x of object tc2
|
||||
cp5.getController("x", tc2).listen(true);
|
||||
|
||||
|
||||
// (uncomment line below) print the a map of all available controller addresses
|
||||
// cp5.printControllerMap();
|
||||
|
||||
// (uncomment line below) access a controller via its address:
|
||||
// println(cp5.getController("/world/x").getInfo());
|
||||
}
|
||||
|
||||
|
||||
|
||||
void draw() {
|
||||
background(m);
|
||||
|
||||
pushMatrix();
|
||||
if (tc1.b) {
|
||||
fill(tc1.x);
|
||||
translate(10, tc1.y);
|
||||
rect(0, 300, 100, 20);
|
||||
}
|
||||
popMatrix();
|
||||
fill(255);
|
||||
text(tc1.in,400,100,150,300);
|
||||
|
||||
|
||||
pushMatrix();
|
||||
if (tc2.b) {
|
||||
fill(tc2.x);
|
||||
translate(200, tc2.y);
|
||||
for (int i=0;i<1;i++) {
|
||||
rect(0, 300, 100, 20);
|
||||
}
|
||||
}
|
||||
popMatrix();
|
||||
fill(255);
|
||||
text(tc2.in,400,300,150,300);
|
||||
|
||||
// the variable x of object tt is controlled by the main program,
|
||||
// the matching controller will update accordingly since it is
|
||||
// listening for changes.
|
||||
tc2.x = (int)random(100);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class TestControl {
|
||||
|
||||
@ControlElement (properties = { "min=0", "max=255" }, x=0, y=0, label="Brightness")
|
||||
public int x = 100;
|
||||
|
||||
@ControlElement (x=0, y=14, label="Y-Position")
|
||||
public float y = 0;
|
||||
|
||||
@ControlElement (x=0, y=40, label="show")
|
||||
public boolean b = true;
|
||||
|
||||
@ControlElement (x=50, y=40)
|
||||
public void toggle(boolean b) {
|
||||
println("hello world");
|
||||
}
|
||||
|
||||
@ControlElement (x=0, y=-20, label="Control", properties = { "type=textlabel"})
|
||||
String s;
|
||||
|
||||
@ControlElement (x=0, y=100, label="Type here")
|
||||
String in = "";
|
||||
|
||||
@ControlElement (x=200, y=25, properties = {"type=list", "items=hello, world, how are you"}, label="Sample-list")
|
||||
public void a(int val) {
|
||||
println(val);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
/**
|
||||
* ControlP5 Basics
|
||||
*
|
||||
* The following example demonstrates the basic use of controlP5.<br />
|
||||
* After initializing controlP5 you can add controllers to controlP5.
|
||||
* Here we use three numberboxes, one slider and one textfield.
|
||||
* The numberbox with name numberboxC will trigger function numberboxC()
|
||||
* in the example below. Whenever controlP5 detects a function in your
|
||||
* sketch that corresponds to the name of a controller, it will forward
|
||||
* an event to that function. Any event triggered by a controller
|
||||
* will be forwarded to function controlEvent in your sketch.
|
||||
* related examples ControlP5numberbox, ControlP5slider, ControlP5textfield
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
public int myColorRect = 200;
|
||||
public int myColorBackground = 100;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// create a slider
|
||||
// parameters:
|
||||
// name, minValue, maxValue, defaultValue, x, y, width, height
|
||||
cp5.addSlider("sliderA", 100, 200, 100, 100, 260, 100, 14);
|
||||
|
||||
|
||||
// create 3 numberboxes and assign an id for each
|
||||
cp5.addNumberbox("numberboxA", myColorRect, 100, 140, 100, 14).setId(1);
|
||||
cp5.addNumberbox("numberboxB", myColorBackground, 100, 180, 100, 14).setId(2);
|
||||
cp5.addNumberbox("numberboxC", 0, 100, 220, 100, 14).setId(3);
|
||||
|
||||
|
||||
// create a texfield
|
||||
cp5.addTextfield("textA", 100, 290, 100, 20);
|
||||
|
||||
// change individual settings for a controller
|
||||
cp5.getController("numberboxA").setMax(255);
|
||||
cp5.getController("numberboxA").setMin(0);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(myColorRect);
|
||||
rect(0, 0, width, 100);
|
||||
}
|
||||
|
||||
|
||||
// events from controller numberboxC are received here
|
||||
public void numberboxC(int theValue) {
|
||||
println("### got an event from numberboxC : "+theValue);
|
||||
}
|
||||
|
||||
|
||||
// an event from slider sliderA will change the value of textfield textA here
|
||||
public void sliderA(int theValue) {
|
||||
Textfield txt = ((Textfield)cp5.getController("textA"));
|
||||
txt.setValue(""+theValue);
|
||||
}
|
||||
|
||||
|
||||
// for every change (a textfield event confirmed with a return) in textfield textA,
|
||||
// function textA will be invoked
|
||||
public void textA(String theValue) {
|
||||
println("### got an event from textA : "+theValue);
|
||||
}
|
||||
|
||||
|
||||
// function controlEvent will be invoked with every value change
|
||||
// in any registered controller
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println("got a control event from controller with id "+theEvent.getId());
|
||||
switch(theEvent.getId()) {
|
||||
case(1): // numberboxA is registered with id 1
|
||||
myColorRect = (int)(theEvent.getController().getValue());
|
||||
break;
|
||||
case(2): // numberboxB is registered with id 2
|
||||
myColorBackground = (int)(theEvent.getController().getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
// TBD
|
|
@ -0,0 +1,125 @@
|
|||
/**
|
||||
* ControlP5 Behavior
|
||||
* ControlBehavior is an abstract class that can be extended using your
|
||||
* custom control behaviors. What is a control behavior? Control Behaviors
|
||||
* allow you to automate and dynamically change the state or value of a
|
||||
* controller. One behavior per controller is currently supported. i case you
|
||||
* need to use more that one bahavior, the implementation has to happen
|
||||
* on your side - inside your control behavior.
|
||||
*
|
||||
* find a list of public methods available for the ControlBehavior Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0, 0, 0);
|
||||
|
||||
public int sliderValue = 100;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addSlider("sliderValue")
|
||||
.setRange(0,255)
|
||||
.setValue(128)
|
||||
.setPosition(100, 50 + height/2)
|
||||
.setSize(40, 100);
|
||||
|
||||
cp5.addSlider("slider")
|
||||
.setRange(100, 255)
|
||||
.setValue(128)
|
||||
.setPosition(100, 50)
|
||||
.setSize(100, 40);
|
||||
|
||||
|
||||
cp5.addBang("bang")
|
||||
.setPosition(40, 50 + height/2)
|
||||
.setSize(40, 40);
|
||||
|
||||
// add a custom ControlBehavior to controller bang,
|
||||
// class TimerEvent is included in this sketch at the bottom
|
||||
// and extends abstract class ControlBehavior.
|
||||
cp5.getController("bang").setBehavior(new TimedEvent());
|
||||
|
||||
// use an anonymous class of type ControlBehavior.
|
||||
cp5.getController("slider").setBehavior(new ControlBehavior() {
|
||||
float a = 0;
|
||||
public void update() {
|
||||
setValue(sin(a += 0.1) * 50 + 150);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(sliderValue);
|
||||
rect(0, 0, width, height/2);
|
||||
}
|
||||
|
||||
void slider(float theColor) {
|
||||
myColorBackground = color(theColor);
|
||||
println("# a slider event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
public void bang() {
|
||||
println("# an event received from controller bang.");
|
||||
// a bang will set the value of controller sliderValue
|
||||
// to a random number between 0 and 255.
|
||||
cp5.getController("sliderValue").setValue(random(0, 255));
|
||||
}
|
||||
|
||||
// custom ControlBehavior
|
||||
class TimedEvent extends ControlBehavior {
|
||||
long myTime;
|
||||
int interval = 200;
|
||||
|
||||
public TimedEvent() {
|
||||
reset();
|
||||
}
|
||||
void reset() {
|
||||
myTime = millis() + interval;
|
||||
}
|
||||
|
||||
public void update() {
|
||||
if (millis()>myTime) {
|
||||
setValue(1);
|
||||
reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControlBehavior Controller
|
||||
use ControlP5.printPublicMethodsFor(ControlBehavior.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControlBehavior in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlBehavior : Controller controller()
|
||||
controlP5.ControlBehavior : boolean isActive()
|
||||
controlP5.ControlBehavior : void setActive(boolean)
|
||||
controlP5.ControlBehavior : void setValue(float)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
CallbackListener toFront = new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
theEvent.getController().bringToFront();
|
||||
((ScrollableList)theEvent.getController()).open();
|
||||
}
|
||||
};
|
||||
|
||||
CallbackListener close = new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
((ScrollableList)theEvent.getController()).close();
|
||||
}
|
||||
};
|
||||
|
||||
cp5.addScrollableList("myList1")
|
||||
.setPosition(100, 100)
|
||||
.addItems(new String[] {"a-1","b-1","c-1","d-1","e-1"})
|
||||
.onEnter(toFront)
|
||||
.onLeave(close)
|
||||
.setWidth(200)
|
||||
.setItemHeight(20)
|
||||
.setBarHeight(20)
|
||||
.setBackgroundColor(color(128))
|
||||
.setHeight(100)
|
||||
.close()
|
||||
;
|
||||
|
||||
cp5.addScrollableList("myList2")
|
||||
.setPosition(100, 125)
|
||||
.addItems(new String[] {"a-2","b-2","c-2","d-2","e-2"})
|
||||
.onEnter(toFront)
|
||||
.onLeave(close)
|
||||
.setWidth(200)
|
||||
.setItemHeight(20)
|
||||
.setBarHeight(20)
|
||||
.setBackgroundColor(color(128))
|
||||
.setHeight(100)
|
||||
.setColor(ControlP5.THEME_RED)
|
||||
.close()
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void draw() {
|
||||
background(220);
|
||||
}
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* ControlP5 Callback
|
||||
*
|
||||
* The following example demonstrates the CallbackListener and CallbackEvent.
|
||||
* Here additional information about each available slider will be show when
|
||||
* hovering the controller with the mouse. The info will fade out when leaving
|
||||
* the controller.
|
||||
*
|
||||
* When hovering a controller, the mouse pointer will change as well.
|
||||
*
|
||||
* find a list of public methods available for the CallbackEvent Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
Slider s1, s2;
|
||||
Info info;
|
||||
CallbackListener cb;
|
||||
|
||||
void setup() {
|
||||
size(800, 400);
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
|
||||
// create a new instance of class Info
|
||||
// info will be used to display a controller's information and
|
||||
// will fade in when a CallbackEvent is invoked.
|
||||
info = new Info();
|
||||
|
||||
|
||||
// add 2 sliders
|
||||
s1 = cp5.addSlider("hello")
|
||||
.setRange(0, 100)
|
||||
.setValue(50)
|
||||
.setPosition(40, 40)
|
||||
.setSize(100, 20);
|
||||
|
||||
s2 = cp5.addSlider("world")
|
||||
.setRange(0, 100)
|
||||
.setValue(10)
|
||||
.setPosition(40, 70)
|
||||
.setSize(100, 20);
|
||||
|
||||
|
||||
// the following CallbackListener will listen to any controlP5
|
||||
// action such as enter, leave, pressed, released, releasedoutside, broadcast
|
||||
// see static variables starting with ACTION_ inside class controlP5.ControlP5Constants
|
||||
|
||||
cb = new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
switch(theEvent.getAction()) {
|
||||
case(ControlP5.ACTION_ENTER):
|
||||
info.n = 1;
|
||||
info.label.setText(theEvent.getController().getInfo());
|
||||
cursor(HAND);
|
||||
break;
|
||||
case(ControlP5.ACTION_LEAVE):
|
||||
case(ControlP5.ACTION_RELEASEDOUTSIDE):
|
||||
info.n = 0;
|
||||
cursor(ARROW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// add the above callback to controlP5
|
||||
cp5.addCallback(cb);
|
||||
|
||||
// add another callback to slider s1, callback event will only be invoked for this
|
||||
// particular controller.
|
||||
s1.addCallback(new CallbackListener() {
|
||||
public void controlEvent(CallbackEvent theEvent) {
|
||||
if (theEvent.getAction()==ControlP5.ACTION_BROADCAST) {
|
||||
s2.setValue(s2.getMax() - s1.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
info.update();
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
println("Got a ControlEvent for "+theEvent.name()+" = "+theEvent.value());
|
||||
info.label.setText(theEvent.getController().getInfo());
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
// uncomment the line below to remove callback cb from controlP5
|
||||
// when a key is pressed.
|
||||
//controlP5.removeCallback(cb);
|
||||
}
|
||||
|
||||
// controlEvent(CallbackEvent) is called whenever a callback
|
||||
// has been triggered. controlEvent(CallbackEvent) is detected by
|
||||
// controlP5 automatically.
|
||||
void controlEvent(CallbackEvent theEvent) {
|
||||
if (theEvent.getController().equals(s2)) {
|
||||
switch(theEvent.getAction()) {
|
||||
case(ControlP5.ACTION_ENTER):
|
||||
println("Action:ENTER");
|
||||
break;
|
||||
case(ControlP5.ACTION_LEAVE):
|
||||
println("Action:LEAVE");
|
||||
break;
|
||||
case(ControlP5.ACTION_PRESSED):
|
||||
println("Action:PRESSED");
|
||||
break;
|
||||
case(ControlP5.ACTION_RELEASED):
|
||||
println("Action:RELEASED");
|
||||
break;
|
||||
case(ControlP5.ACTION_RELEASEDOUTSIDE):
|
||||
println("Action:RELEASED OUTSIDE");
|
||||
break;
|
||||
case(ControlP5.ACTION_BROADCAST):
|
||||
println("Action:BROADCAST");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Info {
|
||||
float a;
|
||||
float n = 0;
|
||||
String txt = "";
|
||||
Textarea label;
|
||||
|
||||
Info() {
|
||||
label = cp5.addTextarea("Hello\nWorld")
|
||||
.setSize(200,200)
|
||||
.setPosition(300,40)
|
||||
.setColor(color(255))
|
||||
.setColorBackground(color(100,0))
|
||||
.setLineHeight(12);
|
||||
|
||||
}
|
||||
|
||||
void update() {
|
||||
a += (n-a)*0.1;
|
||||
label.setColorBackground(color(100,255*a));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the CallbackEvent Controller
|
||||
use ControlP5.printPublicMethodsFor(CallbackEvent.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class CallbackEvent in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.CallbackEvent : Controller getController()
|
||||
controlP5.CallbackEvent : int getAction()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/**
|
||||
* ControlP5 ControlEvent.
|
||||
* every control event is automatically forwarded to the function controlEvent(ControlEvent)
|
||||
* inside a sketch if such function is available. For further details about the API of
|
||||
* the ControlEvent class, please refer to the documentation.
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for ControlEvent
|
||||
* at the bottom of this sketch's source code
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlP5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
public int myColorRect1 = 200;
|
||||
|
||||
public int myColorRect2 = 100;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
noStroke();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addNumberbox("n1")
|
||||
.setValue(myColorRect1)
|
||||
.setPosition(20, 20)
|
||||
.setSize(100, 20)
|
||||
.setMin(0)
|
||||
.setMax(255)
|
||||
.setId(1);
|
||||
|
||||
cp5.addNumberbox("n2")
|
||||
.setValue(myColorRect2)
|
||||
.setPosition(20, 60)
|
||||
.setSize(100, 20)
|
||||
.setMin(0)
|
||||
.setMax(255)
|
||||
.setId(2);
|
||||
|
||||
cp5.addTextfield("n3")
|
||||
.setPosition(20, 100)
|
||||
.setSize(100, 20)
|
||||
.setId(3);
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(ControlP5.MAROON);
|
||||
fill(ControlP5.RED, myColorRect1);
|
||||
rect(140, 20, 240, 170);
|
||||
fill(ControlP5.FUCHSIA, myColorRect2);
|
||||
rect(140, 210, 240, 170);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
println("got a control event from controller with id "+theEvent.getController().getId());
|
||||
|
||||
if (theEvent.isFrom(cp5.getController("n1"))) {
|
||||
println("this event was triggered by Controller n1");
|
||||
}
|
||||
|
||||
switch(theEvent.getController().getId()) {
|
||||
case(1):
|
||||
myColorRect1 = (int)(theEvent.getController().getValue());
|
||||
break;
|
||||
case(2):
|
||||
myColorRect2 = (int)(theEvent.getController().getValue());
|
||||
break;
|
||||
case(3):
|
||||
println(theEvent.getController().getStringValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControlEvent Controller
|
||||
use ControlP5.printPublicMethodsFor(ControlEvent.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControlEvent in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlEvent : ControlGroup getGroup()
|
||||
controlP5.ControlEvent : Controller getController()
|
||||
controlP5.ControlEvent : String getLabel()
|
||||
controlP5.ControlEvent : String getName()
|
||||
controlP5.ControlEvent : String getStringValue()
|
||||
controlP5.ControlEvent : String toString()
|
||||
controlP5.ControlEvent : Tab getTab()
|
||||
controlP5.ControlEvent : boolean isAssignableFrom(Class)
|
||||
controlP5.ControlEvent : boolean isController()
|
||||
controlP5.ControlEvent : boolean isFrom(ControllerInterface)
|
||||
controlP5.ControlEvent : boolean isFrom(String)
|
||||
controlP5.ControlEvent : boolean isGroup()
|
||||
controlP5.ControlEvent : boolean isTab()
|
||||
controlP5.ControlEvent : float getArrayValue(int)
|
||||
controlP5.ControlEvent : float getValue()
|
||||
controlP5.ControlEvent : float[] getArrayValue()
|
||||
controlP5.ControlEvent : int getId()
|
||||
controlP5.ControlEvent : int getType()
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:22:35
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
/**
|
||||
* ControlP5 controlFont.
|
||||
*
|
||||
* this example shows how to create a button with controlP5 (1), how to
|
||||
* load and use a PFont with controlP5 (2), apply a ControlFont to
|
||||
* the caption label of a button (3), and adjust the location of a
|
||||
* caption label using the style() property of a controller.
|
||||
*
|
||||
* by andreas schlegel, 2012
|
||||
*/
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
controlP5.Button b;
|
||||
|
||||
int buttonValue = 1;
|
||||
|
||||
boolean isOpen;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
smooth();
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
// (1)
|
||||
// create some controllers
|
||||
cp5.addButton("button")
|
||||
.setValue(10)
|
||||
.setPosition(20,20)
|
||||
.setSize(100,50)
|
||||
.setId(1);
|
||||
|
||||
b = cp5.addButton("buttonValue")
|
||||
.setValue(4)
|
||||
.setPosition(100,190)
|
||||
.setSize(200,200)
|
||||
.setId(2);
|
||||
|
||||
// (2)
|
||||
// load a new font. ControlFont is a wrapper for processing's PFont
|
||||
// with processing 1.1 ControlFont.setSmooth() is not supported anymore.
|
||||
// to display a font as smooth or non-smooth, use true/false as 3rd parameter
|
||||
// when creating a PFont:
|
||||
|
||||
PFont pfont = createFont("Arial",20,true); // use true/false for smooth/no-smooth
|
||||
ControlFont font = new ControlFont(pfont,241);
|
||||
|
||||
|
||||
|
||||
// (3)
|
||||
// change the font and content of the captionlabels
|
||||
// for both buttons create earlier.
|
||||
cp5.getController("button")
|
||||
.getCaptionLabel()
|
||||
.setFont(font)
|
||||
.toUpperCase(false)
|
||||
.setSize(24)
|
||||
;
|
||||
|
||||
b.getCaptionLabel()
|
||||
.setFont(font)
|
||||
.setSize(50)
|
||||
.toUpperCase(false)
|
||||
.setText("hello")
|
||||
;
|
||||
//
|
||||
// (4)
|
||||
// adjust the location of a catiption label using the
|
||||
// style property of a controller.
|
||||
b.getCaptionLabel().getStyle().marginLeft = 20;
|
||||
b.getCaptionLabel().getStyle().marginTop = 40;
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(ControlP5.SILVER);
|
||||
// animate button b
|
||||
float x = b.x(b.getPosition());
|
||||
x += ((isOpen==true ? 0:-200) - x) * 0.2;;
|
||||
float y = b.y(b.getPosition());
|
||||
b.setPosition(x,y);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println(theEvent.getController().getId());
|
||||
}
|
||||
|
||||
public void button(float theValue) {
|
||||
println("a button event. "+theValue);
|
||||
isOpen = !isOpen;
|
||||
cp5.getController("button").setCaptionLabel((isOpen==true) ? "close":"open");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControlFont Controller
|
||||
use ControlP5.printPublicMethodsFor(ControlFont.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControlFont in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControlFont : PFont getFont()
|
||||
controlP5.ControlFont : int getBaseline()
|
||||
controlP5.ControlFont : int getBottom()
|
||||
controlP5.ControlFont : int getCenter()
|
||||
controlP5.ControlFont : int getHeight()
|
||||
controlP5.ControlFont : int getOffset(int)
|
||||
controlP5.ControlFont : int getOverflow()
|
||||
controlP5.ControlFont : int getSize()
|
||||
controlP5.ControlFont : int getTextHeight()
|
||||
controlP5.ControlFont : int getTop()
|
||||
controlP5.ControlFont : int getWidth()
|
||||
controlP5.ControlFont : void adjust(PGraphics, Label)
|
||||
controlP5.ControlFont : void draw(ControlP5, Label)
|
||||
controlP5.ControlFont : void draw(PGraphics, Label)
|
||||
controlP5.ControlFont : void init(Label)
|
||||
controlP5.ControlFont : void setSize(int)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
created: 2015/03/24 12:22:36
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* ControlP5 Custom View
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the ControllerDisplay Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
smooth();
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addButton("hello")
|
||||
.setPosition(50, 100)
|
||||
.setSize(150,150)
|
||||
.setView(new CircularButton())
|
||||
;
|
||||
|
||||
cp5.addButton("world")
|
||||
.setPosition(250, 100)
|
||||
.setSize(50,50)
|
||||
.setView(new CircularButton())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(ControlP5.BLACK);
|
||||
}
|
||||
|
||||
public void hello(int theValue) {
|
||||
println("Hello pressed");
|
||||
}
|
||||
|
||||
public void world(int theValue) {
|
||||
println("World pressed");
|
||||
}
|
||||
|
||||
/**
|
||||
* to define a custom View for a controller use the ContollerView<T> interface
|
||||
* T here must be replace by the name of the Controller class your custom View will be
|
||||
* applied to. In our example T is replace by Button since we are aplpying the View
|
||||
* to the Button instance create in setup. The ControllerView interface requires
|
||||
* you to implement the display(PApplet, T) method. Same here, T must be replaced by
|
||||
* the Controller class you are designing the custom view for, for us this is the
|
||||
* Button class.
|
||||
*/
|
||||
|
||||
class CircularButton implements ControllerView<Button> {
|
||||
|
||||
public void display(PGraphics theApplet, Button theButton) {
|
||||
theApplet.pushMatrix();
|
||||
if (theButton.isInside()) {
|
||||
if (theButton.isPressed()) { // button is pressed
|
||||
theApplet.fill(ControlP5.LIME);
|
||||
} else { // mouse hovers the button
|
||||
theApplet.fill(ControlP5.YELLOW);
|
||||
}
|
||||
} else { // the mouse is located outside the button area
|
||||
theApplet.fill(ControlP5.GREEN);
|
||||
}
|
||||
|
||||
theApplet.ellipse(0, 0, theButton.getWidth(), theButton.getHeight());
|
||||
|
||||
// center the caption label
|
||||
int x = theButton.getWidth()/2 - theButton.getCaptionLabel().getWidth()/2;
|
||||
int y = theButton.getHeight()/2 - theButton.getCaptionLabel().getHeight()/2;
|
||||
|
||||
translate(x, y);
|
||||
theButton.getCaptionLabel().draw(theApplet);
|
||||
|
||||
theApplet.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControllerView Controller
|
||||
use ControlP5.printPublicMethodsFor(ControllerView.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControllerView in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
controlP5.ControllerView : void display(PApplet, T)
|
||||
|
||||
*/
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
/**
|
||||
* ControlP5 extending Controllers
|
||||
*
|
||||
* the following example shows how to extend the Controller class to
|
||||
* create customizable Controllers. You can either extend the Controller class itself,
|
||||
* or any class that extends Controller itself like the Slider, Button, DropdownList, etc.
|
||||
*
|
||||
* How to:
|
||||
*
|
||||
* 1) do a super call to the convenience constructor requiring
|
||||
* 2 parameter (ControlP5 instance, name)
|
||||
*
|
||||
* 2) the Controller class has a set of empty methods that allow you to capture
|
||||
* inputs from the mouse including
|
||||
* onEnter(), onLeave(), onPress(), onRelease(), onClick(), onScroll(int), onDrag()
|
||||
* These you can override and include functionality as needed.
|
||||
*
|
||||
* 3) use method getPointer() to return the local (relative)
|
||||
* xy-coordinates of the controller
|
||||
*
|
||||
* 4) after instantiation custom controllers are treated the same
|
||||
* as default controlP5 controllers.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
PApplet p;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
// create 2 groups to show nesting of custom controllers and
|
||||
//
|
||||
Group g1 = cp5.addGroup("a").setPosition(0,100).setWidth(180);
|
||||
Group g2 = cp5.addGroup("b").setPosition(0,10).setWidth(180);
|
||||
g2.moveTo(g1);
|
||||
|
||||
// create 2 custom Controllers from class MyButton
|
||||
// MyButton extends Controller and inherits all methods accordingly.
|
||||
new MyButton(cp5, "b1").setPosition(0, 0).setSize(180, 200).moveTo(g2);
|
||||
new MyButton(cp5, "b2").setPosition(205, 15).setSize(180, 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
// b1 will be called from Controller b1
|
||||
public void b1(float theValue) {
|
||||
println("yay button "+theValue);
|
||||
}
|
||||
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println("controlEvent : "+theEvent);
|
||||
}
|
||||
|
||||
|
||||
// Create a custom Controller, please not that
|
||||
// MyButton extends Controller<MyButton>, <MyButton>
|
||||
// is an indicator for the super class about the type of
|
||||
// custom controller to be created.
|
||||
|
||||
class MyButton extends Controller<MyButton> {
|
||||
|
||||
int current = 0xffff0000;
|
||||
|
||||
float a = 128;
|
||||
|
||||
float na;
|
||||
|
||||
int y;
|
||||
|
||||
// use the convenience constructor of super class Controller
|
||||
// MyButton will automatically registered and move to the
|
||||
// default controlP5 tab.
|
||||
|
||||
MyButton(ControlP5 cp5, String theName) {
|
||||
super(cp5, theName);
|
||||
|
||||
// replace the default view with a custom view.
|
||||
setView(new ControllerView() {
|
||||
public void display(PGraphics p, Object b) {
|
||||
// draw button background
|
||||
na += (a-na) * 0.1;
|
||||
p.fill(current,na);
|
||||
p.rect(0, 0, getWidth(), getHeight());
|
||||
|
||||
// draw horizontal line which can be moved on the x-axis
|
||||
// using the scroll wheel.
|
||||
p.fill(0,255,0);
|
||||
p.rect(0,y,width,10);
|
||||
|
||||
// draw the custom label
|
||||
p.fill(128);
|
||||
translate(0,getHeight()+14);
|
||||
p.text(getName(),0,0);
|
||||
p.text(getName(),0,0);
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// override various input methods for mouse input control
|
||||
void onEnter() {
|
||||
cursor(HAND);
|
||||
println("enter");
|
||||
a = 255;
|
||||
}
|
||||
|
||||
void onScroll(int n) {
|
||||
println("scrolling");
|
||||
y -= n;
|
||||
y = constrain(y,0,getHeight()-10);
|
||||
}
|
||||
|
||||
void onPress() {
|
||||
println("press");
|
||||
current = 0xffffff00;
|
||||
}
|
||||
|
||||
void onClick() {
|
||||
Pointer p1 = getPointer();
|
||||
println("clicked at "+p1.x()+", "+p1.y());
|
||||
current = 0xffffff00;
|
||||
setValue(y);
|
||||
}
|
||||
|
||||
void onRelease() {
|
||||
println("release");
|
||||
current = 0xffffffff;
|
||||
}
|
||||
|
||||
void onMove() {
|
||||
println("moving "+this+" "+_myControlWindow.getMouseOverList());
|
||||
}
|
||||
|
||||
void onDrag() {
|
||||
current = 0xff0000ff;
|
||||
Pointer p1 = getPointer();
|
||||
float dif = dist(p1.px(),p1.py(),p1.x(),p1.y());
|
||||
println("dragging at "+p1.x()+", "+p1.y()+" "+dif);
|
||||
}
|
||||
|
||||
void onReleaseOutside() {
|
||||
onLeave();
|
||||
}
|
||||
|
||||
void onLeave() {
|
||||
println("leave");
|
||||
cursor(ARROW);
|
||||
a = 128;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/**
|
||||
* ControlP5 Listener.
|
||||
* the ControlListener interface can be used to implement a custom
|
||||
* ControlListener which listens for incoming ControlEvent from specific
|
||||
* controller(s). MyControlListener in the example below listens to
|
||||
* ControlEvents coming in from controller 'mySlider'.
|
||||
*
|
||||
* by andreas schlegel, 2012
|
||||
*/
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
MyControlListener myListener;
|
||||
|
||||
void setup() {
|
||||
size(700,400);
|
||||
|
||||
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.setColor(ControlP5.THEME_RED);
|
||||
|
||||
cp5.addSlider("mySlider")
|
||||
.setRange(100,200)
|
||||
.setValue(140)
|
||||
.setPosition(200,200)
|
||||
.setSize(200,20);
|
||||
|
||||
myListener = new MyControlListener();
|
||||
|
||||
cp5.getController("mySlider").addListener(myListener);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myListener.col);
|
||||
}
|
||||
|
||||
|
||||
class MyControlListener implements ControlListener {
|
||||
int col;
|
||||
public void controlEvent(ControlEvent theEvent) {
|
||||
println("i got an event from mySlider, " +
|
||||
"changing background color to "+
|
||||
theEvent.getController().getValue());
|
||||
col = (int)theEvent.getController().getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
|
||||
/**
|
||||
* ControlP5 Mouseover
|
||||
*
|
||||
*
|
||||
* this example demonstrates the use of the mouseover methods
|
||||
* isMouseOver(), getMouseOverList()
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
public int slider1 = 64;
|
||||
public int slider2 = 128;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(700, 400);
|
||||
smooth(8);
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addSlider("slider1", 0, 255, 20, 100, 128, 20);
|
||||
cp5.addSlider("slider2", 0, 255, 20, 150, 128, 20);
|
||||
|
||||
ScrollableList l = cp5.addScrollableList("myList", 250, 260, 200, 80);
|
||||
for (int i=0;i<80;i++) {
|
||||
l.addItem("item "+i, i);
|
||||
}
|
||||
|
||||
cp5.addButton("b1", 0, 20, 350, 80, 20);
|
||||
cp5.addButton("b2", 0, 101, 350, 80, 20);
|
||||
|
||||
}
|
||||
|
||||
color hover = color(0, 230, 150);
|
||||
|
||||
void draw() {
|
||||
background(ControlP5.BLACK);
|
||||
// check if the mouse is inside of any of the controllers
|
||||
// displayed in the main window
|
||||
if(cp5.isMouseOver()) {
|
||||
fill(hover);
|
||||
} else {
|
||||
fill(128);
|
||||
}
|
||||
|
||||
ellipse(45,50,50,50);
|
||||
|
||||
// check if the mouse is hovering controller slider1 and set the color accordingly
|
||||
fill(cp5.isMouseOver(cp5.getController("slider1")) ? hover:color(slider1));
|
||||
rect(250, 100, 200, 20);
|
||||
|
||||
|
||||
fill(cp5.isMouseOver(cp5.getController("slider2")) ? hover:color(slider2));
|
||||
rect(250, 150, 200, 20);
|
||||
|
||||
fill(cp5.isMouseOver(cp5.getController("b1")) ? hover:color(128));
|
||||
ellipse(30, 330, 20, 20);
|
||||
|
||||
fill(cp5.isMouseOver(cp5.getController("b2")) ? hover:color(128));
|
||||
ellipse(110, 330, 20, 20);
|
||||
|
||||
fill(cp5.isMouseOver(cp5.getController("myList")) ? hover:color(128));
|
||||
ellipse(260, 230, 20, 20);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void mousePressed() {
|
||||
// print the current mouseoverlist on mouse pressed
|
||||
print("The Current mouseoverlist:\t");
|
||||
println(cp5.getWindow().getMouseOverList());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControlP5 Controller
|
||||
use ControlP5.printPublicMethodsFor(ControlP5.class);
|
||||
to print the full list into the console.
|
||||
|
||||
You can find further details about class ControlP5 in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
controlP5.ControlP5 : List getMouseOverList()
|
||||
controlP5.ControlP5 : boolean isMouseOver()
|
||||
controlP5.ControlP5 : boolean isMouseOver(ControllerInterface)
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
* ControlP5 plugTo
|
||||
*
|
||||
* This example demonstrate how to use the plugTo method to
|
||||
* connect a controller to a field or method of a particular object.
|
||||
*
|
||||
*
|
||||
* find a list of public methods available for the ControlP5 Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2011
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
import processing.opengl.*;
|
||||
|
||||
ControlP5 controlP5;
|
||||
|
||||
Test[] testarray;
|
||||
|
||||
Test test;
|
||||
|
||||
Button b;
|
||||
|
||||
int cnt;
|
||||
|
||||
void setup() {
|
||||
size(600,400);
|
||||
smooth();
|
||||
test = new Test(50);
|
||||
testarray = new Test[10];
|
||||
for(int i=0;i<10;i++) {
|
||||
testarray[i] = new Test(200 + i*20);
|
||||
}
|
||||
|
||||
controlP5 = new ControlP5(this);
|
||||
|
||||
controlP5.begin(100,20);
|
||||
|
||||
b = controlP5.addButton("trigger",1);
|
||||
b.setColorBackground(ControlP5.RED);
|
||||
|
||||
controlP5.addButton("plug",2);
|
||||
controlP5.addButton("unplug",3);
|
||||
|
||||
// b is a button previously added to controlP5 with name 'trigger'
|
||||
// controlP5 no tries to find a field or method inside object test
|
||||
// in order to connect controller 'trigger' with test.trigger()
|
||||
b.plugTo(test);
|
||||
controlP5.end();
|
||||
}
|
||||
|
||||
// connects controller 'trigger' with objects of type Test contained
|
||||
// inside arrat testarray
|
||||
void plug(int theValue) {
|
||||
b.plugTo(testarray);
|
||||
b.setColorBackground(ControlP5.GREEN);
|
||||
println("plugging controller b1 to array 'testarray' and variable 'test'.");
|
||||
}
|
||||
|
||||
// disconnects controller 'trigger' from objects of type Test stored
|
||||
// inside array testarray
|
||||
void unplug(int theValue) {
|
||||
b.unplugFrom(testarray);
|
||||
b.setColorBackground(ControlP5.RED);
|
||||
println("removing array 'testarray' and variable 'test' from controller b1.");
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
fill(255);
|
||||
for(int i=0;i<10;i++) {
|
||||
testarray[i].display();
|
||||
}
|
||||
test.display();
|
||||
cnt++;
|
||||
if(cnt%30 == 0) {
|
||||
controlP5.getController("trigger").update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Test {
|
||||
float n0 = 0;
|
||||
float n1 = 1;
|
||||
float x;
|
||||
|
||||
Test(float theX) {
|
||||
x = theX;
|
||||
}
|
||||
|
||||
void trigger(int theValue) {
|
||||
n1 = random(100);
|
||||
}
|
||||
|
||||
void display() {
|
||||
n0 += (n1-n0) * 0.1;
|
||||
rect(x,200,10,n0);
|
||||
}
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
//println("\t\t b1 event sub \n\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* ControlP5 properties example (see keyPressed).
|
||||
* by andreas schlegel, 2011
|
||||
*
|
||||
* status: experimental
|
||||
* saves/loads controller values into/from a properties-file
|
||||
* by default properties will be saved in a serialized format and use the .ser extension.
|
||||
*
|
||||
* taken from the changelog;
|
||||
* adding saveProperties(String) and loadProperties(String) to
|
||||
* save and load serialized controller properties.
|
||||
* The range of controllers implementing save/load properties currently includes
|
||||
* Slider, Knob, Numberbox, Toggle, Checkbox, RadioButton, Textlabel, Matrix,Range,
|
||||
* textarea, ListBox, Dropdown, colorPicker.
|
||||
* Properties are currently saved in the java serialization
|
||||
* format but xml and possibly json alternatives are being worked on.
|
||||
*
|
||||
*
|
||||
* default properties load/save key combinations are
|
||||
* alt+shift+l to load properties
|
||||
* alt+shift+s to save properties
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
public int myColor = color(0,0,0);
|
||||
|
||||
public int sliderValue = 100;
|
||||
public int sliderTicks1 = 100;
|
||||
public int sliderTicks2 = 30;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
cp5 = new ControlP5(this);
|
||||
noStroke();
|
||||
// add a vertical slider
|
||||
cp5.addSlider("slider")
|
||||
.setRange(0,200)
|
||||
.setValue(128)
|
||||
.setPosition(20,100)
|
||||
.setSize(20,100)
|
||||
;
|
||||
// create another slider with tick marks, now without
|
||||
// default value, the initial value will be set according th
|
||||
// the value of variable sliderTicks2 then.
|
||||
cp5.addSlider("sliderTicks1")
|
||||
.setRange(0,255)
|
||||
.setPosition(100,100)
|
||||
.setSize(20,100)
|
||||
.setNumberOfTickMarks(5)
|
||||
;
|
||||
|
||||
|
||||
// add horizontal sliders
|
||||
cp5.addSlider("sliderValue")
|
||||
.setRange(0,255)
|
||||
.setValue(128)
|
||||
.setPosition(200,180)
|
||||
.setSize(100,20)
|
||||
;
|
||||
|
||||
cp5.addSlider("sliderTicks2")
|
||||
.setRange(0,255)
|
||||
.setValue(128)
|
||||
.setPosition(200,220)
|
||||
.setSize(100,20)
|
||||
.setNumberOfTickMarks(7)
|
||||
.setSliderMode(Slider.FLEXIBLE);
|
||||
;
|
||||
// use Slider.FIX or Slider.FLEXIBLE to change the slider handle
|
||||
// by default it is Slider.FIX
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(sliderTicks1);
|
||||
|
||||
fill(sliderValue);
|
||||
rect(0,0,width,100);
|
||||
|
||||
fill(myColor);
|
||||
rect(0,300,width,70);
|
||||
|
||||
fill(sliderTicks2);
|
||||
rect(0,370,width,30);
|
||||
}
|
||||
|
||||
public void slider(float theColor) {
|
||||
myColor = color(theColor);
|
||||
println("a slider event. setting background to "+theColor);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
// default properties load/save key combinations are
|
||||
// alt+shift+l to load properties
|
||||
// alt+shift+s to save properties
|
||||
if(key=='1') {
|
||||
cp5.saveProperties(("hello.json"));
|
||||
} else if(key=='2') {
|
||||
cp5.loadProperties(("hello.json"));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"/sliderValue": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 128
|
||||
},
|
||||
"/slider": {
|
||||
"min": 0,
|
||||
"max": 200,
|
||||
"value": 128
|
||||
},
|
||||
"/sliderTicks1": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 127.5
|
||||
},
|
||||
"/sliderTicks2": {
|
||||
"min": 0,
|
||||
"max": 255,
|
||||
"value": 127.5
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* ControlP5 quick
|
||||
*
|
||||
* this example demonstrates how to quickly add Controllers such as
|
||||
* Button, Slider,Toggle and Numberbox to a sketch without having to set
|
||||
* positions, this is done automatically by cp5.
|
||||
* controllers will be aligned horizontally - .linebreak() will
|
||||
* force the next controller to the next line.
|
||||
* the example shows as well how to link variables and functions to
|
||||
* a controller. this is done by assigning the name of the variable
|
||||
* or function to a controller.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
float s1 = 5;
|
||||
float s2 = 2;
|
||||
boolean t1 = true;
|
||||
boolean t2 = true;
|
||||
boolean t3 = true;
|
||||
boolean t4 = true;
|
||||
float n1 = 100;
|
||||
int n2 = 50;
|
||||
|
||||
void setup() {
|
||||
size(600,400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
cp5.addButton("b1",1);
|
||||
cp5.addButton("b2",2);
|
||||
cp5.addButton("b3",3);
|
||||
cp5.addButton("b4",4).linebreak();
|
||||
cp5.addSlider("s1",0,10);
|
||||
cp5.addSlider("s2",0,10).linebreak();
|
||||
cp5.addButton("b5");
|
||||
cp5.addToggle("t1");
|
||||
cp5.addToggle("t2");
|
||||
cp5.addToggle("t3");
|
||||
cp5.addToggle("t4").linebreak();
|
||||
cp5.addNumberbox("n1");
|
||||
cp5.addNumberbox("n2");
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
if(t1) {
|
||||
fill(s1*25);
|
||||
rect(0,200,150,height);
|
||||
}
|
||||
if(t2) {
|
||||
fill(s2*25);
|
||||
rect(150,200,150,height);
|
||||
}
|
||||
if(t3) {
|
||||
fill(n1);
|
||||
rect(300,200,150,height);
|
||||
}
|
||||
if(t4) {
|
||||
fill(n2);
|
||||
rect(450,200,150,height);
|
||||
}
|
||||
}
|
||||
|
||||
void b1(int theN) {
|
||||
println(theN);
|
||||
}
|
||||
|
||||
void b2(int theN) {
|
||||
println(theN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* ControlP5 Slider set value
|
||||
* changes the value of a slider on keyPressed
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlP5
|
||||
*
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
int myColorBackground = color(0,0,0);
|
||||
|
||||
int sliderValue = 100;
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
noStroke();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addSlider("sliderValue")
|
||||
.setRange(100,200)
|
||||
.setValue(120)
|
||||
.setPosition(100,200)
|
||||
.setSize(100,10)
|
||||
;
|
||||
|
||||
|
||||
cp5.addSlider("slider")
|
||||
.setRange(100,200)
|
||||
.setValue(128)
|
||||
.setPosition(100,160)
|
||||
.setSize(100,10);
|
||||
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(sliderValue);
|
||||
rect(0,0,width,100);
|
||||
}
|
||||
|
||||
void slider(int theColor) {
|
||||
myColorBackground = color(theColor);
|
||||
println("a slider event. setting background to "+theColor);
|
||||
cp5.getController("sliderValue").setValue(theColor);
|
||||
}
|
||||
|
||||
void keyPressed() {
|
||||
cp5.getController("sliderValue").setValue(150);
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/**
|
||||
* ControlP5 snapshot
|
||||
*
|
||||
* this example shows how to use the snapshot methods for ControllerProperties.
|
||||
* Snapshots allow you to save controller states in memory, recall, save and remove them.
|
||||
*
|
||||
* How to load, save and remove snapshots? see keyPressed()
|
||||
*
|
||||
* find a list of public methods available for the ControllerProperties Controller
|
||||
* at the bottom of this sketch.
|
||||
*
|
||||
* by Andreas Schlegel, 2012
|
||||
* www.sojamo.de/libraries/controlp5
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import controlP5.*;
|
||||
ControlP5 cp5;
|
||||
|
||||
public float n = 50;
|
||||
public float s = 10;
|
||||
public float k = 100;
|
||||
|
||||
void setup() {
|
||||
size(400, 400);
|
||||
smooth();
|
||||
cp5 = new ControlP5(this);
|
||||
|
||||
cp5.addNumberbox("n")
|
||||
.setPosition(10, 10)
|
||||
.setSize(42, 16)
|
||||
.setMultiplier(0.1)
|
||||
.setRange(10,60)
|
||||
.setValue(20)
|
||||
;
|
||||
|
||||
cp5.addSlider("s")
|
||||
.setPosition(10, 100)
|
||||
.setSize(100, 20)
|
||||
.setScrollSensitivity(0.01)
|
||||
.setRange(60,140)
|
||||
.setValue(100)
|
||||
;
|
||||
|
||||
|
||||
cp5.addKnob("k")
|
||||
.setPosition(200, 100)
|
||||
.setRadius(50)
|
||||
.setScrollSensitivity(0.001)
|
||||
.setMin(60)
|
||||
.setMax(140)
|
||||
.setDisplayStyle(Controller.ARC)
|
||||
;
|
||||
|
||||
cp5.addRange("r")
|
||||
.setPosition(10,200)
|
||||
.setSize(100,20)
|
||||
.setRange(0, 200)
|
||||
.setRangeValues(50,100)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
}
|
||||
|
||||
|
||||
void keyPressed() {
|
||||
switch(key) {
|
||||
case('1'):
|
||||
cp5.getProperties().setSnapshot("hello1");
|
||||
break;
|
||||
case('2'):
|
||||
cp5.getProperties().setSnapshot("hello2");
|
||||
break;
|
||||
case('3'):
|
||||
cp5.getProperties().setSnapshot("hello3");
|
||||
break;
|
||||
|
||||
case('a'):
|
||||
cp5.getProperties().getSnapshot("hello1");
|
||||
break;
|
||||
case('s'):
|
||||
cp5.getProperties().getSnapshot("hello2");
|
||||
break;
|
||||
case('d'):
|
||||
cp5.getProperties().getSnapshot("hello3");
|
||||
break;
|
||||
|
||||
case('z'):
|
||||
cp5.getProperties().removeSnapshot("hello1");
|
||||
break;
|
||||
case('x'):
|
||||
cp5.getProperties().removeSnapshot("hello2");
|
||||
break;
|
||||
case('c'):
|
||||
cp5.getProperties().removeSnapshot("hello3");
|
||||
break;
|
||||
|
||||
case('i'):
|
||||
cp5.getProperties().saveSnapshot("hello1");
|
||||
break;
|
||||
case('o'):
|
||||
cp5.getProperties().load("hello1.ser");
|
||||
break;
|
||||
}
|
||||
|
||||
println(cp5.getProperties().getSnapshotIndices());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
a list of all methods available for the ControllerProperties Controller
|
||||
use ControlP5.printPublicMethodsFor(ControllerProperties.class);
|
||||
to print the following list into the console.
|
||||
|
||||
You can find further details about class ControllerProperties in the javadoc.
|
||||
|
||||
Format:
|
||||
ClassName : returnType methodName(parameter type)
|
||||
|
||||
|
||||
controlP5.ControllerProperties : ArrayList getSnapshotIndices()
|
||||
controlP5.ControllerProperties : ControllerProperties addSet(String)
|
||||
controlP5.ControllerProperties : ControllerProperties delete(ControllerProperty)
|
||||
controlP5.ControllerProperties : ControllerProperties getSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties move(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties move(ControllerProperty, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties only(ControllerProperty, String)
|
||||
controlP5.ControllerProperties : ControllerProperties print()
|
||||
controlP5.ControllerProperties : ControllerProperties register(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperties remove(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties removeSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties saveSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties saveSnapshotAs(String, String)
|
||||
controlP5.ControllerProperties : ControllerProperties setSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperties updateSnapshot(String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String)
|
||||
controlP5.ControllerProperties : ControllerProperty getProperty(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : ControllerProperty register(ControllerInterface, String, String)
|
||||
controlP5.ControllerProperties : HashSet getPropertySet(ControllerInterface)
|
||||
controlP5.ControllerProperties : List get(ControllerInterface)
|
||||
controlP5.ControllerProperties : Map get()
|
||||
controlP5.ControllerProperties : String toString()
|
||||
controlP5.ControllerProperties : boolean load()
|
||||
controlP5.ControllerProperties : boolean load(String)
|
||||
controlP5.ControllerProperties : boolean save()
|
||||
controlP5.ControllerProperties : boolean saveAs(String)
|
||||
controlP5.ControllerProperties : void setFormat(Format)
|
||||
java.lang.Object : String toString()
|
||||
java.lang.Object : boolean equals(Object)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/**
|
||||
* controlP5workingWithIDs by andreas schlegel
|
||||
* an example to show how to distinguish controllers by IDs.
|
||||
* further information in the documentation folder provided in the controlP5 folder.
|
||||
* controlP5 website at http://www.sojamo.de/controlP5
|
||||
*/
|
||||
|
||||
import controlP5.*;
|
||||
|
||||
ControlP5 cp5;
|
||||
|
||||
public int myColorRect = 200;
|
||||
|
||||
public int myColorBackground = 40;
|
||||
|
||||
|
||||
void setup() {
|
||||
size(400,400);
|
||||
|
||||
noStroke();
|
||||
|
||||
/* new instance of ControlP5 */
|
||||
cp5 = new ControlP5(this);
|
||||
/* add 2 controllers and give each of them a unique id. */
|
||||
cp5.addNumberbox("numberbox1")
|
||||
.setPosition(100,160)
|
||||
.setSize(100,14)
|
||||
.setId(1)
|
||||
.setValue(myColorRect);
|
||||
|
||||
cp5.addSlider("slider1")
|
||||
.setRange(10,200)
|
||||
.setValue(myColorBackground)
|
||||
.setPosition(100,220)
|
||||
.setSize(100,10)
|
||||
.setId(2);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
background(myColorBackground);
|
||||
fill(myColorRect);
|
||||
rect(0,0,width,100);
|
||||
}
|
||||
|
||||
|
||||
void controlEvent(ControlEvent theEvent) {
|
||||
/* events triggered by controllers are automatically forwarded to
|
||||
the controlEvent method. by checking the id of a controller one can distinguish
|
||||
which of the controllers has been changed.
|
||||
*/
|
||||
println("got a control event from controller with id "+theEvent.getController().getId());
|
||||
switch(theEvent.getController().getId()) {
|
||||
case(1):
|
||||
/* controller numberbox1 with id 1 */
|
||||
myColorRect = (int)theEvent.getValue();
|
||||
break;
|
||||
case(2):
|
||||
/* controller slider1 with id 2 */
|
||||
myColorBackground = (int)theEvent.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
# UTF-8 supported.
|
||||
|
||||
# The name of your library as you want it formatted
|
||||
name = ControlP5
|
||||
|
||||
# List of authors. Links can be provided using the syntax [author name](url)
|
||||
authorList = [Andreas Schlegel](http://www.sojamo.de/)
|
||||
|
||||
# A website for your library
|
||||
url = http://www.sojamo.de/libraries/controlp5
|
||||
|
||||
# The category of your library, must be one (or many) of the following:
|
||||
# "3D" "Animation" "Compilations" "Data"
|
||||
# "Fabrication" "Geometry" "GUI" "Hardware"
|
||||
# "I/O" "Language" "Math" "Simulation"
|
||||
# "Sound" "Utilities" "Typography" "Video & Vision"
|
||||
#
|
||||
# If a value other than those listed is used, your library will listed as "Other."
|
||||
category = GUI
|
||||
|
||||
# A short sentence (fragment) to summarize the library's function. This will be
|
||||
# shown from inside the PDE when the library is being installed. Avoid repeating
|
||||
# the name of your library here. Also, avoid saying anything redundant like
|
||||
# mentioning that its a library.
|
||||
sentence = A GUI library to build custom user interfaces for desktop and android mode.
|
||||
|
||||
# Additional information suitable for the Processing website. The value of
|
||||
# 'sentence' always will be prepended, so you should start by writing the
|
||||
# second sentence here. If your library only works on certain operating systems,
|
||||
# mention it here.
|
||||
paragraph = Includes interface elements such as slider, button, knob, toggle, textfield, dropdown menu, listbox, tabs, charts and more.
|
||||
|
||||
# Links in the 'sentence' and 'paragraph' attributes can be inserted using the
|
||||
# same syntax as for authors. That is, [here is a link to Processing](http://processing.org/)
|
||||
|
||||
|
||||
# A version number that increments once with each release. This
|
||||
# is used to compare different versions of the same library, and
|
||||
# check if an update is available. You should think of it as a
|
||||
# counter, counting the total number of releases you've had.
|
||||
version = 84 # This must be parsable as an int
|
||||
|
||||
# The version as the user will see it. If blank, the version attribute will be used here
|
||||
prettyVersion = 2.2.5 # This is treated as a String
|
Binary file not shown.
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!-- NewPage -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_20) on Thu Jul 30 17:27:41 SGT 2015 -->
|
||||
<title>All Classes (Javadocs: controlP5)</title>
|
||||
<meta name="date" content="2015-07-30">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="bar">All Classes</h1>
|
||||
<div class="indexContainer">
|
||||
<ul>
|
||||
<li><a href="controlP5/Accordion.html" title="class in controlP5" target="classFrame">Accordion</a></li>
|
||||
<li><a href="controlP5/Background.html" title="class in controlP5" target="classFrame">Background</a></li>
|
||||
<li><a href="controlP5/Bang.html" title="class in controlP5" target="classFrame">Bang</a></li>
|
||||
<li><a href="controlP5/BitFont.html" title="class in controlP5" target="classFrame">BitFont</a></li>
|
||||
<li><a href="controlP5/Button.html" title="class in controlP5" target="classFrame">Button</a></li>
|
||||
<li><a href="controlP5/ButtonBar.html" title="class in controlP5" target="classFrame">ButtonBar</a></li>
|
||||
<li><a href="controlP5/CallbackEvent.html" title="class in controlP5" target="classFrame">CallbackEvent</a></li>
|
||||
<li><a href="controlP5/CallbackListener.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">CallbackListener</span></a></li>
|
||||
<li><a href="controlP5/Canvas.html" title="class in controlP5" target="classFrame">Canvas</a></li>
|
||||
<li><a href="controlP5/CColor.html" title="class in controlP5" target="classFrame">CColor</a></li>
|
||||
<li><a href="controlP5/CDrawable.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">CDrawable</span></a></li>
|
||||
<li><a href="controlP5/Chart.html" title="class in controlP5" target="classFrame">Chart</a></li>
|
||||
<li><a href="controlP5/ChartData.html" title="class in controlP5" target="classFrame">ChartData</a></li>
|
||||
<li><a href="controlP5/ChartDataSet.html" title="class in controlP5" target="classFrame">ChartDataSet</a></li>
|
||||
<li><a href="controlP5/CheckBox.html" title="class in controlP5" target="classFrame">CheckBox</a></li>
|
||||
<li><a href="controlP5/ColorPicker.html" title="class in controlP5" target="classFrame">ColorPicker</a></li>
|
||||
<li><a href="controlP5/ColorWheel.html" title="class in controlP5" target="classFrame">ColorWheel</a></li>
|
||||
<li><a href="controlP5/ControlBehavior.html" title="class in controlP5" target="classFrame">ControlBehavior</a></li>
|
||||
<li><a href="controlP5/ControlBroadcaster.html" title="class in controlP5" target="classFrame">ControlBroadcaster</a></li>
|
||||
<li><a href="controlP5/ControlElement.html" title="annotation in controlP5" target="classFrame">ControlElement</a></li>
|
||||
<li><a href="controlP5/ControlEvent.html" title="class in controlP5" target="classFrame">ControlEvent</a></li>
|
||||
<li><a href="controlP5/ControlFont.html" title="class in controlP5" target="classFrame">ControlFont</a></li>
|
||||
<li><a href="controlP5/ControlGroup.html" title="class in controlP5" target="classFrame">ControlGroup</a></li>
|
||||
<li><a href="controlP5/ControlKey.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">ControlKey</span></a></li>
|
||||
<li><a href="controlP5/Controller.html" title="class in controlP5" target="classFrame">Controller</a></li>
|
||||
<li><a href="controlP5/ControllerGroup.html" title="class in controlP5" target="classFrame">ControllerGroup</a></li>
|
||||
<li><a href="controlP5/ControllerInterface.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">ControllerInterface</span></a></li>
|
||||
<li><a href="controlP5/ControllerList.html" title="class in controlP5" target="classFrame">ControllerList</a></li>
|
||||
<li><a href="controlP5/ControllerPlug.html" title="class in controlP5" target="classFrame">ControllerPlug</a></li>
|
||||
<li><a href="controlP5/ControllerProperties.html" title="class in controlP5" target="classFrame">ControllerProperties</a></li>
|
||||
<li><a href="controlP5/ControllerProperty.html" title="class in controlP5" target="classFrame">ControllerProperty</a></li>
|
||||
<li><a href="controlP5/ControllerStyle.html" title="class in controlP5" target="classFrame">ControllerStyle</a></li>
|
||||
<li><a href="controlP5/ControllerView.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">ControllerView</span></a></li>
|
||||
<li><a href="controlP5/ControlListener.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">ControlListener</span></a></li>
|
||||
<li><a href="controlP5/ControlP5.html" title="class in controlP5" target="classFrame">ControlP5</a></li>
|
||||
<li><a href="controlP5/ControlP5Base.html" title="class in controlP5" target="classFrame">ControlP5Base</a></li>
|
||||
<li><a href="controlP5/ControlP5Constants.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">ControlP5Constants</span></a></li>
|
||||
<li><a href="controlP5/ControlP5Legacy.html" title="class in controlP5" target="classFrame">ControlP5Legacy</a></li>
|
||||
<li><a href="controlP5/ControlTimer.html" title="class in controlP5" target="classFrame">ControlTimer</a></li>
|
||||
<li><a href="controlP5/ControlWindow.html" title="class in controlP5" target="classFrame">ControlWindow</a></li>
|
||||
<li><a href="controlP5/CP.html" title="class in controlP5" target="classFrame">CP</a></li>
|
||||
<li><a href="controlP5/DropdownList.html" title="class in controlP5" target="classFrame">DropdownList</a></li>
|
||||
<li><a href="controlP5/DropdownList.DropdownListView.html" title="class in controlP5" target="classFrame">DropdownList.DropdownListView</a></li>
|
||||
<li><a href="controlP5/FrameRate.html" title="class in controlP5" target="classFrame">FrameRate</a></li>
|
||||
<li><a href="controlP5/Group.html" title="class in controlP5" target="classFrame">Group</a></li>
|
||||
<li><a href="controlP5/Icon.html" title="class in controlP5" target="classFrame">Icon</a></li>
|
||||
<li><a href="controlP5/Knob.html" title="class in controlP5" target="classFrame">Knob</a></li>
|
||||
<li><a href="controlP5/Label.html" title="class in controlP5" target="classFrame">Label</a></li>
|
||||
<li><a href="controlP5/ListBox.html" title="class in controlP5" target="classFrame">ListBox</a></li>
|
||||
<li><a href="controlP5/ListBox.ListBoxView.html" title="class in controlP5" target="classFrame">ListBox.ListBoxView</a></li>
|
||||
<li><a href="controlP5/Matrix.html" title="class in controlP5" target="classFrame">Matrix</a></li>
|
||||
<li><a href="controlP5/MultiList.html" title="class in controlP5" target="classFrame">MultiList</a></li>
|
||||
<li><a href="controlP5/MultiListButton.html" title="class in controlP5" target="classFrame">MultiListButton</a></li>
|
||||
<li><a href="controlP5/Numberbox.html" title="class in controlP5" target="classFrame">Numberbox</a></li>
|
||||
<li><a href="controlP5/Pointer.html" title="interface in controlP5" target="classFrame"><span class="interfaceName">Pointer</span></a></li>
|
||||
<li><a href="controlP5/Println.html" title="class in controlP5" target="classFrame">Println</a></li>
|
||||
<li><a href="controlP5/Radio.html" title="class in controlP5" target="classFrame">Radio</a></li>
|
||||
<li><a href="controlP5/RadioButton.html" title="class in controlP5" target="classFrame">RadioButton</a></li>
|
||||
<li><a href="controlP5/Range.html" title="class in controlP5" target="classFrame">Range</a></li>
|
||||
<li><a href="controlP5/ScrollableList.html" title="class in controlP5" target="classFrame">ScrollableList</a></li>
|
||||
<li><a href="controlP5/ScrollableList.ScrollableListView.html" title="class in controlP5" target="classFrame">ScrollableList.ScrollableListView</a></li>
|
||||
<li><a href="controlP5/Slider.html" title="class in controlP5" target="classFrame">Slider</a></li>
|
||||
<li><a href="controlP5/Slider2D.html" title="class in controlP5" target="classFrame">Slider2D</a></li>
|
||||
<li><a href="controlP5/Spacer.html" title="class in controlP5" target="classFrame">Spacer</a></li>
|
||||
<li><a href="controlP5/Tab.html" title="class in controlP5" target="classFrame">Tab</a></li>
|
||||
<li><a href="controlP5/Textarea.html" title="class in controlP5" target="classFrame">Textarea</a></li>
|
||||
<li><a href="controlP5/Textfield.html" title="class in controlP5" target="classFrame">Textfield</a></li>
|
||||
<li><a href="controlP5/Textfield.InputFilter.html" title="enum in controlP5" target="classFrame">Textfield.InputFilter</a></li>
|
||||
<li><a href="controlP5/Textlabel.html" title="class in controlP5" target="classFrame">Textlabel</a></li>
|
||||
<li><a href="controlP5/TickMark.html" title="class in controlP5" target="classFrame">TickMark</a></li>
|
||||
<li><a href="controlP5/Toggle.html" title="class in controlP5" target="classFrame">Toggle</a></li>
|
||||
<li><a href="controlP5/Tooltip.html" title="class in controlP5" target="classFrame">Tooltip</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,90 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<!-- NewPage -->
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_20) on Thu Jul 30 17:27:41 SGT 2015 -->
|
||||
<title>All Classes (Javadocs: controlP5)</title>
|
||||
<meta name="date" content="2015-07-30">
|
||||
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="bar">All Classes</h1>
|
||||
<div class="indexContainer">
|
||||
<ul>
|
||||
<li><a href="controlP5/Accordion.html" title="class in controlP5">Accordion</a></li>
|
||||
<li><a href="controlP5/Background.html" title="class in controlP5">Background</a></li>
|
||||
<li><a href="controlP5/Bang.html" title="class in controlP5">Bang</a></li>
|
||||
<li><a href="controlP5/BitFont.html" title="class in controlP5">BitFont</a></li>
|
||||
<li><a href="controlP5/Button.html" title="class in controlP5">Button</a></li>
|
||||
<li><a href="controlP5/ButtonBar.html" title="class in controlP5">ButtonBar</a></li>
|
||||
<li><a href="controlP5/CallbackEvent.html" title="class in controlP5">CallbackEvent</a></li>
|
||||
<li><a href="controlP5/CallbackListener.html" title="interface in controlP5"><span class="interfaceName">CallbackListener</span></a></li>
|
||||
<li><a href="controlP5/Canvas.html" title="class in controlP5">Canvas</a></li>
|
||||
<li><a href="controlP5/CColor.html" title="class in controlP5">CColor</a></li>
|
||||
<li><a href="controlP5/CDrawable.html" title="interface in controlP5"><span class="interfaceName">CDrawable</span></a></li>
|
||||
<li><a href="controlP5/Chart.html" title="class in controlP5">Chart</a></li>
|
||||
<li><a href="controlP5/ChartData.html" title="class in controlP5">ChartData</a></li>
|
||||
<li><a href="controlP5/ChartDataSet.html" title="class in controlP5">ChartDataSet</a></li>
|
||||
<li><a href="controlP5/CheckBox.html" title="class in controlP5">CheckBox</a></li>
|
||||
<li><a href="controlP5/ColorPicker.html" title="class in controlP5">ColorPicker</a></li>
|
||||
<li><a href="controlP5/ColorWheel.html" title="class in controlP5">ColorWheel</a></li>
|
||||
<li><a href="controlP5/ControlBehavior.html" title="class in controlP5">ControlBehavior</a></li>
|
||||
<li><a href="controlP5/ControlBroadcaster.html" title="class in controlP5">ControlBroadcaster</a></li>
|
||||
<li><a href="controlP5/ControlElement.html" title="annotation in controlP5">ControlElement</a></li>
|
||||
<li><a href="controlP5/ControlEvent.html" title="class in controlP5">ControlEvent</a></li>
|
||||
<li><a href="controlP5/ControlFont.html" title="class in controlP5">ControlFont</a></li>
|
||||
<li><a href="controlP5/ControlGroup.html" title="class in controlP5">ControlGroup</a></li>
|
||||
<li><a href="controlP5/ControlKey.html" title="interface in controlP5"><span class="interfaceName">ControlKey</span></a></li>
|
||||
<li><a href="controlP5/Controller.html" title="class in controlP5">Controller</a></li>
|
||||
<li><a href="controlP5/ControllerGroup.html" title="class in controlP5">ControllerGroup</a></li>
|
||||
<li><a href="controlP5/ControllerInterface.html" title="interface in controlP5"><span class="interfaceName">ControllerInterface</span></a></li>
|
||||
<li><a href="controlP5/ControllerList.html" title="class in controlP5">ControllerList</a></li>
|
||||
<li><a href="controlP5/ControllerPlug.html" title="class in controlP5">ControllerPlug</a></li>
|
||||
<li><a href="controlP5/ControllerProperties.html" title="class in controlP5">ControllerProperties</a></li>
|
||||
<li><a href="controlP5/ControllerProperty.html" title="class in controlP5">ControllerProperty</a></li>
|
||||
<li><a href="controlP5/ControllerStyle.html" title="class in controlP5">ControllerStyle</a></li>
|
||||
<li><a href="controlP5/ControllerView.html" title="interface in controlP5"><span class="interfaceName">ControllerView</span></a></li>
|
||||
<li><a href="controlP5/ControlListener.html" title="interface in controlP5"><span class="interfaceName">ControlListener</span></a></li>
|
||||
<li><a href="controlP5/ControlP5.html" title="class in controlP5">ControlP5</a></li>
|
||||
<li><a href="controlP5/ControlP5Base.html" title="class in controlP5">ControlP5Base</a></li>
|
||||
<li><a href="controlP5/ControlP5Constants.html" title="interface in controlP5"><span class="interfaceName">ControlP5Constants</span></a></li>
|
||||
<li><a href="controlP5/ControlP5Legacy.html" title="class in controlP5">ControlP5Legacy</a></li>
|
||||
<li><a href="controlP5/ControlTimer.html" title="class in controlP5">ControlTimer</a></li>
|
||||
<li><a href="controlP5/ControlWindow.html" title="class in controlP5">ControlWindow</a></li>
|
||||
<li><a href="controlP5/CP.html" title="class in controlP5">CP</a></li>
|
||||
<li><a href="controlP5/DropdownList.html" title="class in controlP5">DropdownList</a></li>
|
||||
<li><a href="controlP5/DropdownList.DropdownListView.html" title="class in controlP5">DropdownList.DropdownListView</a></li>
|
||||
<li><a href="controlP5/FrameRate.html" title="class in controlP5">FrameRate</a></li>
|
||||
<li><a href="controlP5/Group.html" title="class in controlP5">Group</a></li>
|
||||
<li><a href="controlP5/Icon.html" title="class in controlP5">Icon</a></li>
|
||||
<li><a href="controlP5/Knob.html" title="class in controlP5">Knob</a></li>
|
||||
<li><a href="controlP5/Label.html" title="class in controlP5">Label</a></li>
|
||||
<li><a href="controlP5/ListBox.html" title="class in controlP5">ListBox</a></li>
|
||||
<li><a href="controlP5/ListBox.ListBoxView.html" title="class in controlP5">ListBox.ListBoxView</a></li>
|
||||
<li><a href="controlP5/Matrix.html" title="class in controlP5">Matrix</a></li>
|
||||
<li><a href="controlP5/MultiList.html" title="class in controlP5">MultiList</a></li>
|
||||
<li><a href="controlP5/MultiListButton.html" title="class in controlP5">MultiListButton</a></li>
|
||||
<li><a href="controlP5/Numberbox.html" title="class in controlP5">Numberbox</a></li>
|
||||
<li><a href="controlP5/Pointer.html" title="interface in controlP5"><span class="interfaceName">Pointer</span></a></li>
|
||||
<li><a href="controlP5/Println.html" title="class in controlP5">Println</a></li>
|
||||
<li><a href="controlP5/Radio.html" title="class in controlP5">Radio</a></li>
|
||||
<li><a href="controlP5/RadioButton.html" title="class in controlP5">RadioButton</a></li>
|
||||
<li><a href="controlP5/Range.html" title="class in controlP5">Range</a></li>
|
||||
<li><a href="controlP5/ScrollableList.html" title="class in controlP5">ScrollableList</a></li>
|
||||
<li><a href="controlP5/ScrollableList.ScrollableListView.html" title="class in controlP5">ScrollableList.ScrollableListView</a></li>
|
||||
<li><a href="controlP5/Slider.html" title="class in controlP5">Slider</a></li>
|
||||
<li><a href="controlP5/Slider2D.html" title="class in controlP5">Slider2D</a></li>
|
||||
<li><a href="controlP5/Spacer.html" title="class in controlP5">Spacer</a></li>
|
||||
<li><a href="controlP5/Tab.html" title="class in controlP5">Tab</a></li>
|
||||
<li><a href="controlP5/Textarea.html" title="class in controlP5">Textarea</a></li>
|
||||
<li><a href="controlP5/Textfield.html" title="class in controlP5">Textfield</a></li>
|
||||
<li><a href="controlP5/Textfield.InputFilter.html" title="enum in controlP5">Textfield.InputFilter</a></li>
|
||||
<li><a href="controlP5/Textlabel.html" title="class in controlP5">Textlabel</a></li>
|
||||
<li><a href="controlP5/TickMark.html" title="class in controlP5">TickMark</a></li>
|
||||
<li><a href="controlP5/Toggle.html" title="class in controlP5">Toggle</a></li>
|
||||
<li><a href="controlP5/Tooltip.html" title="class in controlP5">Tooltip</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue