Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

ControlP5 Button Functions Always Firing

$
0
0

I've seen that some other users have had issues with the controlP5 button controllers firing on app launch. My controller seems to be firing all the time, even if I use a flag to prevent the function from running on the first call. Here's my code:

void draw_start_screen() {
  cp5 = new ControlP5(this);

  cp5.addButton("buttonA")
     .setValue(0)
     .setPosition(W/2,H/2)
     .setSize(100,100);
}

void buttonA(int theValue) {
  if (firstLoop) {
    firstLoop = false;
  }

  println(theValue);
}

When I run my app, it continuously prints 0 to the console. Does anyone have a solution to this issue?


Viewing all articles
Browse latest Browse all 2896

Trending Articles