We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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):
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; } } }
Answers
I guess that
mouseButton
can not be used in android mode.What is this supposed to do? How do you right-click on a smartphone?
(new iPhone doesn' t count...)
Yes, mouseButton isn't available for touch devices, but you could use onLongPress() (for example) from the Ketai library as a substitute for right-click.
I know that i cannot use mouseButton, i didn't suppose to right click on a smartphone. My question was about how can i use the switch button on an android device, because i used it in a java project, and i need to convert it. like: My code
Can i use like:
@MarcoReverse=== what version of processing??? as for android you can use SimpleOnGestureListener, which detects a lot of motionevents (tap, doubletap, fling...)...
@akenator i've processing 3.0. but can i put the motion events in the switch?
@MarcoReverse== it worked with P2; never tried with P3. But why not??? - i ll see that ASAP.