mousePressed not working correctly in Galaxy S2
I have an issue with the following code, copied from http://android.processing.org/tutorials/getting_started/index.html On my Galaxy S3 (Android 4.4.2) it works perfectly, but on my Galaxy S2 (Android 4.1.2) the event mousePressed is not recognized half of the times, so I have to tap the screen twice instead of once. I have also tried a different Galaxy S2, same issue.
void setup() { fullScreen(); noStroke(); fill(0); }
void draw() { background(204); if (mousePressed) { if (mouseX < width/2) { rect(0, 0, width/2, height); // Left } else { rect(width/2, 0, width/2, height); // Right } } }
The problem is related to fullScreen(). If I don't use that, but instead use size(800,480), that is the full screen size of my Galaxy S2, everything works correctly. Of course this is not a good solution because it's the wrong size for most other devices. The workaround I'm using now to have everything work as expected is: void settings() { size(displayWidth, displayHeight); }
Thanks for the report and the workaround. I will look into it.