Mercurial > sdl-ios-xcode
annotate include/SDL_touch.h @ 5056:8b7988f42fcb
Added the ability to get the UIKit window through the SDL API.
You can also do this through the native API:
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
Also needed to name the union for events and window info.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 20 Jan 2011 16:05:59 -0800 |
parents | f9ab8df6d45a |
children | b530ef003506 |
rev | line source |
---|---|
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
1 /* |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
4 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
9 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
14 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
18 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
19 Sam Lantinga |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
20 slouken@libsdl.org |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
21 */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
22 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
23 /** |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
24 * \file SDL_touch.h |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
25 * |
4659
063b9455bd1a
Added some files I had previosuly missed
Jim Grandpre <jim.tla@gmail.com>
parents:
4655
diff
changeset
|
26 * Include file for SDL touch event handling. |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
27 */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
28 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
29 #ifndef _SDL_touch_h |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
30 #define _SDL_touch_h |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
31 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
32 #include "SDL_stdinc.h" |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
33 #include "SDL_error.h" |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
34 #include "SDL_video.h" |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
35 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
36 #include "begin_code.h" |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
37 /* Set up for C function definitions, even when using C++ */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
38 #ifdef __cplusplus |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
39 /* *INDENT-OFF* */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
40 extern "C" { |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
41 /* *INDENT-ON* */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
42 #endif |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
43 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
44 |
4679
5ee96ba0c01e
Fixed various type and print format issues
Sam Lantinga <slouken@libsdl.org>
parents:
4678
diff
changeset
|
45 typedef Sint64 SDL_TouchID; |
5ee96ba0c01e
Fixed various type and print format issues
Sam Lantinga <slouken@libsdl.org>
parents:
4678
diff
changeset
|
46 typedef Sint64 SDL_FingerID; |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
47 |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
48 |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
49 struct SDL_Finger { |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
50 SDL_FingerID id; |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
51 Uint16 x; |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
52 Uint16 y; |
4689
f9ab8df6d45a
Added README.touch and README.gesture. Moved touchtest/gestureSDLTest to test/testgesture
Jim Grandpre <jim.tla@gmail.com>
parents:
4679
diff
changeset
|
53 Uint16 pressure; |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
54 Uint16 xdelta; |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
55 Uint16 ydelta; |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
56 Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */ |
4655
4c94f2023d62
Fixed bugs in input, cleaned up $1
Jim Grandpre <jim.tla@gmail.com>
parents:
4649
diff
changeset
|
57 SDL_bool down; |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
58 }; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
59 |
4649 | 60 typedef struct SDL_Touch SDL_Touch; |
61 typedef struct SDL_Finger SDL_Finger; | |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
62 |
4649 | 63 |
64 struct SDL_Touch { | |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
65 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
66 /* Free the touch when it's time */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
67 void (*FreeTouch) (SDL_Touch * touch); |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
68 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
69 /* data common for tablets */ |
4676
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4659
diff
changeset
|
70 float pressure_max, pressure_min; |
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4659
diff
changeset
|
71 float x_max,x_min; |
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4659
diff
changeset
|
72 float y_max,y_min; |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
73 Uint16 xres,yres,pressureres; |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
74 float native_xres,native_yres,native_pressureres; |
4676
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4659
diff
changeset
|
75 float tilt; /* for future use */ |
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4659
diff
changeset
|
76 float rotation; /* for future use */ |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
77 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
78 /* Data common to all touch */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
79 SDL_TouchID id; |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
80 SDL_Window *focus; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
81 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
82 char *name; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
83 Uint8 buttonstate; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
84 SDL_bool relative_mode; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
85 SDL_bool flush_motion; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
86 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
87 int num_fingers; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
88 int max_fingers; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
89 SDL_Finger** fingers; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
90 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
91 void *driverdata; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
92 }; |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
93 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
94 |
4649 | 95 |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
96 /* Function prototypes */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
97 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
98 /** |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
99 * \brief Get the touch object at the given id. |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
100 * |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
101 * |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
102 */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
103 extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id); |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
104 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
105 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
106 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
107 /** |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
108 * \brief Get the finger object of the given touch, at the given id. |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
109 * |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
110 * |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
111 */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
112 extern |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4676
diff
changeset
|
113 DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id); |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
114 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
115 /* Ends C function definitions when using C++ */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
116 #ifdef __cplusplus |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
117 /* *INDENT-OFF* */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
118 } |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
119 /* *INDENT-ON* */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
120 #endif |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
121 #include "close_code.h" |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
122 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
123 #endif /* _SDL_mouse_h */ |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
124 |
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
125 /* vi: set ts=4 sw=4 expandtab: */ |