News of The Wolf

Random, hopefully interesting technical ramblings

Writing a GUI in Processing

Posted by chemicaloliver on 15/05/2009

When I first started looking into the Processing language it is quickly apparent that out of the box there is very little in the way of handling user input by way of GUIs. This has been rectified in a very nice way by the team who developed controlP5 this is in my opinion the easiest GUI library I’ve ever used enabling me to create sliders and knobs in a matter of minutes, having programmed very little in processing before. What I came up with is the start of the interface for my planned ardunio controlled synth system:

My controlP5 GUI example

My controlP5 GUI example



import controlP5.*;

ControlP5 controlP5;
int myColorBackground = color(0,0,0);

void setup() {
size(400,200);
controlP5 = new ControlP5(this);
controlP5.addSlider("Pitch",0,100,50,50,50,10,100);
controlP5.addSlider("LFO",0,100,50,150,50,10,100);
controlP5.addSlider("Duty Cycle",0,100,50,250,50,10,100);
controlP5.addKnob("Volume",0,11,5,330,70,40);
}

void draw() {
background(myColorBackground);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: