Hi,
I have startet using ControlP5 for a small 2D landscape generator I'm working on at the moment.
The basic landscape/background is generated with if(mousePressed).
My goal is that there are multiple elements (just simple shapes), that can
be shown/hidden with simple buttons/toggles.
I have tried somethings but am currently stumped.
This is somewhat what the basic structure of the code looks like
This is somewhat what the basic structure of the code looks like
- import controlP5.*;
- ControlP5 controlP5;
- ControlWindow controlWindow;
- boolean lake = false;
- float ran;
- void setup(){
- size(1000, 768);
- background(255);
- smooth();
- controlP5 = new ControlP5(this);
- controlP5.setAutoDraw(false);
- controlWindow = controlP5.addControlWindow("controlP5window",205,173,400,500);
- controlWindow.hideCoordinates();
- controlWindow.setBackground(color(200));
- Toggle lake = controlP5.addToggle("Lake",false,40,40,100,10);
- lake.setWindow(controlWindow);
- }
- void draw(){
- if (mousePressed){
- if(lake==true) {
- noStroke();
- ellipse(230,430,100,200);
- fill(255,255,0);
- }
- }
- }
What am I missing? Should I look at (controlEvent)?
Thank you in advance for any help
Thank you in advance for any help
1