diff src/SDL.c @ 2674:f1d07ba2e275 gsoc2008_nds

Started adding framework for Touchscreen API, based on and (consistent with) the existing Joystick API.
author Darren Alton <dalton@stevens.edu>
date Mon, 23 Jun 2008 11:55:26 +0000
parents 8f1ab2f7c722
children 3895761db26a
line wrap: on
line diff
--- a/src/SDL.c	Thu Jun 19 07:11:35 2008 +0000
+++ b/src/SDL.c	Mon Jun 23 11:55:26 2008 +0000
@@ -38,6 +38,10 @@
 extern int SDL_JoystickInit(void);
 extern void SDL_JoystickQuit(void);
 #endif
+#if !SDL_TOUCHSCREEN_DISABLED
+extern int SDL_TouchscreenInit(void);
+extern void SDL_TouchscreenQuit(void);
+#endif
 #if !SDL_CDROM_DISABLED
 extern int SDL_CDROMInit(void);
 extern void SDL_CDROMQuit(void);
@@ -123,6 +127,21 @@
     }
 #endif
 
+#if !SDL_TOUCHSCREEN_DISABLED
+    /* Initialize the touchscreen subsystem */
+    if ((flags & SDL_INIT_TOUCHSCREEN) && !(SDL_initialized & SDL_INIT_TOUCHSCREEN)) {
+        if (SDL_TouchscreenInit() < 0) {
+            return (-1);
+        }
+        SDL_initialized |= SDL_INIT_TOUCHSCREEN;
+    }
+#else
+    if (flags & SDL_INIT_TOUCHSCREEN) {
+        SDL_SetError("SDL not built with touchscreen support");
+        return (-1);
+    }
+#endif
+
 #if !SDL_CDROM_DISABLED
     /* Initialize the CD-ROM subsystem */
     if ((flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM)) {
@@ -180,6 +199,12 @@
         SDL_initialized &= ~SDL_INIT_JOYSTICK;
     }
 #endif
+#if !SDL_TOUCHSCREEN_DISABLED
+    if ((flags & SDL_initialized & SDL_INIT_TOUCHSCREEN)) {
+        SDL_TouchscreenQuit();
+        SDL_initialized &= ~SDL_INIT_TOUCHSCREEN;
+    }
+#endif
 #if !SDL_TIMERS_DISABLED
     if ((flags & SDL_initialized & SDL_INIT_TIMER)) {
         SDL_TimerQuit();