Commit 4392c6ff146e668b2099de86993317f50072e007

Sylvain Becker 2019-06-11T11:01:15

Android: fix coordinates for Surface.ROTATION_180 https://discourse.libsdl.org/t/android-screen-orientation-issues-2-0-9/26262

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
index d0e2f8a..ff24ba8 100644
--- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
+++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
@@ -1971,8 +1971,8 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
                     newOrientation = SDLActivity.SDL_ORIENTATION_LANDSCAPE_FLIPPED;
                     break;
                 case Surface.ROTATION_180:
-                    x = -event.values[1];
-                    y = -event.values[0];
+                    x = -event.values[0];
+                    y = -event.values[1];
                     newOrientation = SDLActivity.SDL_ORIENTATION_PORTRAIT_FLIPPED;
                     break;
                 default: