hi
I’m using buttons to switch states and in Java it works fine but when I run my sketch on AndroidMode, I need to double tap to activate the button. Does anyone knows how to fix this?
here is my code:
final int stateMenu = 0;
final int statePresetEditor = 1;
final int stateLiveMode = 2;
int state;
ControlP5 cp5;
void setup() {
size(400, 850);
setupGUI();
}
void draw() {
background(0);
switch(state) {
case stateLiveMode:
background(30);
break;
case statePresetEditor:
background(255);
break;
case stateMenu:
background(0);
break;
}
}
//GUI
void setupGUI(){
cp5 = new ControlP5(this);
cp5.addButton(“Live”)
.setValue(2)
.setPosition(width/2, height/3)
.setSize(150,30);
cp5.addButton(“Edit_presets”)
.setValue(1)
.setPosition(width/2, height/3 + 90)
.setSize(150,30);
cp5.addButton(“Menu”)
.setValue(0)
.setPosition(width/2, height*2/3)
.setSize(150,30);
}
void Live(int value) {
state = value;
}
void Edit_presets(int value) {
state = value;
}
void Menu(int value) {
state = value;
}
`