ControlP5 Button Functions Always Firing

edited November 2015 in Library Questions

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?

Tagged:

Answers

Sign In or Register to comment.