SDL: testmouse: Create the window on the touch screen when building for the 3DS

From 154ec5c57a97ba7cdfeedebd8919b119f23da64e Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Sat, 13 Apr 2024 23:23:18 +0100
Subject: [PATCH] testmouse: Create the window on the touch screen when
 building for the 3DS

---
 test/testmouse.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/test/testmouse.c b/test/testmouse.c
index 0583ead5a1d61..1622a48e65f7d 100644
--- a/test/testmouse.c
+++ b/test/testmouse.c
@@ -18,7 +18,13 @@
 
 #include <stdlib.h> /* exit() */
 
-#ifdef __IPHONEOS__
+#ifdef __3DS__
+/* For mouse-based tests, we want to have the window on the touch screen */
+#define SCREEN_X 40
+#define SCREEN_Y 240
+#define SCREEN_WIDTH    320
+#define SCREEN_HEIGHT   240
+#elif defined(__IPHONEOS__)
 #define SCREEN_WIDTH    320
 #define SCREEN_HEIGHT   480
 #else
@@ -26,6 +32,13 @@
 #define SCREEN_HEIGHT 480
 #endif
 
+#ifndef SCREEN_X
+#define SCREEN_X SDL_WINDOWPOS_CENTERED
+#endif
+#ifndef SCREEN_Y
+#define SCREEN_Y SDL_WINDOWPOS_CENTERED
+#endif
+
 static SDL_Window *window;
 
 typedef struct _Object
@@ -263,9 +276,7 @@ int main(int argc, char *argv[])
     }
 
     /* Create a window to display joystick axis position */
-    window = SDL_CreateWindow("Mouse Test", SDL_WINDOWPOS_CENTERED,
-                              SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH,
-                              SCREEN_HEIGHT, 0);
+    window = SDL_CreateWindow("Mouse Test", SCREEN_X, SCREEN_Y, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
     if (!window) {
         SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
         return SDL_FALSE;