annotate src/touchscreen/SDL_systouchscreen.h @ 2675:5e4274591163 gsoc2008_nds

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