comparison 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
comparison
equal deleted inserted replaced
2673:24a6b3588eac 2674:f1d07ba2e275
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 Sam Lantinga
4
5 This library is SDL_free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 /* This is the system specific header for the SDL touchscreen API */
25
26 #include "SDL_touchscreen.h"
27
28 /* The SDL touchscreen structure */
29 struct _SDL_Touchscreen
30 {
31 Uint8 index; /* Device index */
32 const char *name; /* Touchscreen name - system dependent */
33
34 int maxpoints; /* Max # multi-touch points, -1 if unlimited. */
35 int npoints; /* Number of points currently touched */
36 struct touchpoint
37 {
38 int x;
39 int y;
40 int pressure;
41 } *points; /* Current ball motion deltas */
42
43 struct touchscreen_hwdata *hwdata; /* Driver dependent information */
44
45 int ref_count; /* Reference count for multiple opens */
46 };
47
48 /* Function to scan the system for touchscreens.
49 * Touchscreen 0 should be the system default touchscreen.
50 * This function should return the number of available touchscreens, or -1
51 * on an unrecoverable fatal error.
52 */
53 extern int SDL_SYS_TouchscreenInit(void);
54
55 /* Function to get the device-dependent name of a touchscreen */
56 extern const char *SDL_SYS_TouchscreenName(int index);
57
58 /* Function to open a touchscreen for use.
59 The touchscreen to open is specified by the index field of the touchscreen.
60 This should fill the maxpoints field of the touchscreen structure.
61 It returns 0, or -1 if there is an error.
62 */
63 extern int SDL_SYS_TouchscreenOpen(SDL_Touchscreen * touchscreen);
64
65 /* Function to update the state of a touchscreen - called as a device poll.
66 * This function shouldn't update the touchscreen structure directly,
67 * but instead should call SDL_PrivateTouchscreen*() to deliver events
68 * and update touchscreen device state.
69 */
70 extern void SDL_SYS_TouchscreenUpdate(SDL_Touchscreen * touchscreen);
71
72 /* Function to close a touchscreen after use */
73 extern void SDL_SYS_TouchscreenClose(SDL_Touchscreen * touchscreen);
74
75 /* Function to perform any system-specific touchscreen related cleanup */
76 extern void SDL_SYS_TouchscreenQuit(void);
77
78 /* vi: set ts=4 sw=4 expandtab: */