patrickms / rugl

Automatically exported from code.google.com/p/rugl
0 stars 0 forks source link

Touchevents are off if the screen isn't 800x480 #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Install Minedroid on a HVGA phone
2. Use touch analog sticks

What version of the product are you using? On what operating system?
Newest Minedroid on a Galaxy Spica

The problem is caused by the code that transforms the y touch event coordinates 
from the smaller screen to 800x480

It's all in Touch.java in the methods addPrimary, addSecondary, updatePointer 
and updatePointers

The faulty code in all 4 methods is:
Pointer p = new Pointer( me.getPointerId( pointerIndex ) );
p.x = me.getX( pointerIndex ) * xScale;
p.y = me.getY( pointerIndex ) * yScale;
p.y = Game.height - p.y;
p.size = me.getSize( pointerIndex );

and should be replaced by

Pointer p = new Pointer(me.getPointerId(pointerIndex));
p.x = me.getX(pointerIndex) * xScale;
p.y = Game.height - me.getY(pointerIndex);
p.y = p.y * yScale;
p.size = me.getSize(pointerIndex);

Original issue reported on code.google.com by robert.tieber on 23 Feb 2011 at 8:23

GoogleCodeExporter commented 9 years ago
My favourite kind of bug report - one that comes complete with a fix!
Cheers dude - fix incorporated.

Original comment by therealryan on 24 Feb 2011 at 10:05