Skip to content

Commit 9eddd5e

Browse files
committed
fix touch offest in window mode
1 parent c1038d1 commit 9eddd5e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/src/org/renpy/android/SDLSurfaceView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ public boolean onTouchEvent(final MotionEvent event) {
888888
int sdlAction = -1;
889889
int pointerId = -1;
890890
int pointerIndex = -1;
891+
int[] coords = new int[2];
892+
this.getLocationInWindow(coords);
891893

892894
switch ( action ) {
893895
case MotionEvent.ACTION_DOWN:
@@ -937,8 +939,8 @@ public boolean onTouchEvent(final MotionEvent event) {
937939
));
938940
**/
939941
SDLSurfaceView.nativeMouse(
940-
(int)event.getX(i),
941-
(int)event.getY(i),
942+
(int)event.getX(i) - coords[0],
943+
(int)event.getY(i) - coords[1],
942944
sdlAction,
943945
event.getPointerId(i),
944946
(int)(event.getPressure(i) * 1000.0),

0 commit comments

Comments
 (0)