diff src/touchscreen/SDL_systouchscreen.h @ 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
children 5e4274591163
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/touchscreen/SDL_systouchscreen.h	Mon Jun 23 11:55:26 2008 +0000
@@ -0,0 +1,78 @@
+/*
+    SDL - Simple DirectMedia Layer
+    Copyright (C) 1997-2006 Sam Lantinga
+
+    This library is SDL_free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+    Sam Lantinga
+    slouken@libsdl.org
+*/
+#include "SDL_config.h"
+
+/* This is the system specific header for the SDL touchscreen API */
+
+#include "SDL_touchscreen.h"
+
+/* The SDL touchscreen structure */
+struct _SDL_Touchscreen
+{
+    Uint8 index;                /* Device index */
+    const char *name;           /* Touchscreen name - system dependent */
+
+    int maxpoints;              /* Max # multi-touch points, -1 if unlimited. */
+    int npoints;                /* Number of points currently touched */
+    struct touchpoint
+    {
+        int x;
+        int y;
+        int pressure;
+    } *points;                   /* Current ball motion deltas */
+
+    struct touchscreen_hwdata *hwdata;     /* Driver dependent information */
+
+    int ref_count;              /* Reference count for multiple opens */
+};
+
+/* Function to scan the system for touchscreens.
+ * Touchscreen 0 should be the system default touchscreen.
+ * This function should return the number of available touchscreens, or -1
+ * on an unrecoverable fatal error.
+ */
+extern int SDL_SYS_TouchscreenInit(void);
+
+/* Function to get the device-dependent name of a touchscreen */
+extern const char *SDL_SYS_TouchscreenName(int index);
+
+/* Function to open a touchscreen for use.
+   The touchscreen to open is specified by the index field of the touchscreen.
+   This should fill the maxpoints field of the touchscreen structure.
+   It returns 0, or -1 if there is an error.
+ */
+extern int SDL_SYS_TouchscreenOpen(SDL_Touchscreen * touchscreen);
+
+/* Function to update the state of a touchscreen - called as a device poll.
+ * This function shouldn't update the touchscreen structure directly,
+ * but instead should call SDL_PrivateTouchscreen*() to deliver events
+ * and update touchscreen device state.
+ */
+extern void SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen);
+
+/* Function to close a touchscreen after use */
+extern void SDL_SYS_TouchscreenClose(SDL_Touchscreen * touchscreen);
+
+/* Function to perform any system-specific touchscreen related cleanup */
+extern void SDL_SYS_TouchscreenQuit(void);
+
+/* vi: set ts=4 sw=4 expandtab: */