Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

How can i use switch(mouseButton) in android mode?

$
0
0

Hi, this is the part of my code that works on java mode, but obviously it doesn't work in android mode, so my question is, can i use this kind of switch on my android project? How can i make this work? I tried to change the mouse button with mouse pressed but i understood that i cannot use a boolean in a switch. This is the error that occurs every time (5 equals errors):


  1. ERROR in /private/var/folders/7h/__943dks5895p0qs_txz9p700000gn/T/android1454252317288703044sketch/src/processing/test/catchme/CatchMe.java (at line 101) switch(mouseButton) { ^^^^^^^^^^^

mouseButton cannot be resolved to a variable

This is the part of code of the first error:


void draw(){ // state if(mousePressed){ if(state == stateMenu){ if (rectOver) { switch(mouseButton) { case LEFT: state = statePlay; break; case RIGHT: state =stateLost; break; case ESC: // quit exit(); break; default: // do nothing break; } } }

}


Viewing all articles
Browse latest Browse all 941

Trending Articles