Mercurial > sdl-ios-xcode
comparison src/events/SDL_touch_c.h @ 4640:f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
author | Jim Grandpre <jim.tla@gmail.com> |
---|---|
date | Tue, 25 May 2010 23:23:23 -0400 |
parents | |
children | 49a97daea6ec |
comparison
equal
deleted
inserted
replaced
4639:f5cd4b6231ba | 4640:f068a6dfc858 |
---|---|
1 /* | |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2010 Sam Lantinga | |
4 | |
5 This library is 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 #ifndef _SDL_touch_c_h | |
25 #define _SDL_touch_c_h | |
26 | |
27 typedef struct SDL_Touch SDL_Touch; | |
28 | |
29 | |
30 struct SDL_Touch | |
31 { | |
32 /* Warp the touch to (x,y) */ | |
33 void (*WarpTouch) (SDL_Touch * touch, SDL_Window * window, int x, | |
34 int y); | |
35 | |
36 /* Free the touch when it's time */ | |
37 void (*FreeTouch) (SDL_Touch * touch); | |
38 | |
39 /* data common for tablets */ | |
40 int pressure; | |
41 int pressure_max; | |
42 int pressure_min; | |
43 int tilt; /* for future use */ | |
44 int rotation; /* for future use */ | |
45 int total_ends; | |
46 int current_end; | |
47 | |
48 /* Data common to all touch */ | |
49 int id; | |
50 SDL_Window *focus; | |
51 int which; | |
52 int x; | |
53 int y; | |
54 int z; /* for future use */ | |
55 int xdelta; | |
56 int ydelta; | |
57 int last_x, last_y; /* the last reported x and y coordinates */ | |
58 char *name; | |
59 Uint8 buttonstate; | |
60 SDL_bool relative_mode; | |
61 SDL_bool proximity; | |
62 SDL_bool flush_motion; | |
63 | |
64 SDL_Cursor *cursors; | |
65 SDL_Cursor *def_cursor; | |
66 SDL_Cursor *cur_cursor; | |
67 SDL_bool cursor_shown; | |
68 | |
69 void *driverdata; | |
70 }; | |
71 | |
72 /* Initialize the touch subsystem */ | |
73 extern int SDL_TouchInit(void); | |
74 | |
75 /* Get the touch at an index */ | |
76 extern SDL_Touch *SDL_GetTouch(int index); | |
77 | |
78 /* Add a touch, possibly reattaching at a particular index (or -1), | |
79 returning the index of the touch, or -1 if there was an error. | |
80 */ | |
81 extern int SDL_AddTouch(const SDL_Touch * touch, char *name, | |
82 int pressure_max, int pressure_min, int ends); | |
83 | |
84 /* Remove a touch at an index, clearing the slot for later */ | |
85 extern void SDL_DelTouch(int index); | |
86 | |
87 /* Clear the button state of a touch at an index */ | |
88 extern void SDL_ResetTouch(int index); | |
89 | |
90 /* Set the touch focus window */ | |
91 extern void SDL_SetTouchFocus(int id, SDL_Window * window); | |
92 | |
93 /* Send a touch motion event for a touch */ | |
94 extern int SDL_SendTouchMotion(int id, int relative, int x, int y, int z); | |
95 | |
96 /* Send a touch button event for a touch */ | |
97 extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button); | |
98 | |
99 /* Send a touch wheel event for a touch */ | |
100 extern int SDL_SendTouchWheel(int id, int x, int y); | |
101 | |
102 /* Send a proximity event for a touch */ | |
103 extern int SDL_SendProximity(int id, int x, int y, int type); | |
104 | |
105 /* Shutdown the touch subsystem */ | |
106 extern void SDL_TouchQuit(void); | |
107 | |
108 /* FIXME: Where do these functions go in this header? */ | |
109 extern void SDL_ChangeEnd(int id, int end); | |
110 | |
111 #endif /* _SDL_touch_c_h */ | |
112 | |
113 /* vi: set ts=4 sw=4 expandtab: */ |