Mercurial > sdl-ios-xcode
annotate src/events/SDL_touch_c.h @ 5113:481dabb098ef
Improved timer implementation
The new timer model is formalized as using a separate thread to handle timer callbacks. This was the case on almost every platform before, but it's now a requirement, and simplifies the implementation and makes it perform consistently across platforms.
Goals:
* Minimize timer thread blocking
* Dispatch timers as accurately as possible
* SDL_AddTimer() and SDL_RemoveTimer() are completely threadsafe
* SDL_RemoveTimer() doesn't crash with a timer that's expired or removed
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 27 Jan 2011 14:45:06 -0800 |
parents | f8431f66613d |
children | b530ef003506 |
rev | line source |
---|---|
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
1 /* |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
4 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
9 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
14 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
18 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
19 Sam Lantinga |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
20 slouken@libsdl.org |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
21 */ |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
4646
eea1bf53effa
Added include/touch.h Now reading in resolution of touch pad.
Jim Grandpre <jim.tla@gmail.com>
parents:
4645
diff
changeset
|
23 #include "../../include/SDL_touch.h" |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
24 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
25 #ifndef _SDL_touch_c_h |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
26 #define _SDL_touch_c_h |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
27 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
28 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
29 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
30 /* Initialize the touch subsystem */ |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
31 extern int SDL_TouchInit(void); |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
32 |
4642
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
33 /*Get the touch at an index */ |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
34 extern SDL_Touch *SDL_GetTouchIndex(int index); |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
35 |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
36 /* Get the touch with id = id */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
37 extern SDL_Touch *SDL_GetTouch(SDL_TouchID id); |
4642
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
38 |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
39 /*Get the finger at an index */ |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
40 extern SDL_Finger *SDL_GetFingerIndex(SDL_Touch *touch, int index); |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
41 |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
42 /* Get the finger with id = id */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
43 extern SDL_Finger *SDL_GetFinger(SDL_Touch *touch,SDL_FingerID id); |
4642
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
44 |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
45 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
46 /* Add a touch, possibly reattaching at a particular index (or -1), |
4642
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
47 returning the index of the touch, or -1 if there was an error. */ |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
48 extern int SDL_AddTouch(const SDL_Touch * touch, char *name); |
057e8762d2a1
Added reading of event* for touch events.
Jim Grandpre <jim.tla@gmail.com>
parents:
4641
diff
changeset
|
49 |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
50 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
51 /* Remove a touch at an index, clearing the slot for later */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
52 extern void SDL_DelTouch(SDL_TouchID id); |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
53 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
54 /* Set the touch focus window */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
55 extern void SDL_SetTouchFocus(SDL_TouchID id, SDL_Window * window); |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
56 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
57 /* Send a touch motion event for a touch */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
58 extern int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, |
4676
99b4560b7aa1
Upgraded touchId/fingerId to long. Changed position variables to floats.
jimtla
parents:
4648
diff
changeset
|
59 int relative, float x, float y, float z); |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
60 |
4677
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
4676
diff
changeset
|
61 /* Send a touch down/up event for a touch */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
62 extern int SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, |
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
63 SDL_bool down, float x, float y, float pressure); |
4677
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
4676
diff
changeset
|
64 |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
65 /* Send a touch button event for a touch */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
66 extern int SDL_SendTouchButton(SDL_TouchID id, Uint8 state, Uint8 button); |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
67 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
68 /* Shutdown the touch subsystem */ |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
69 extern void SDL_TouchQuit(void); |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
70 |
4647
be2250bb482b
Fixed some windows compilation bugs - Still does not compile.
jimtla
parents:
4646
diff
changeset
|
71 /* Get the index of a touch device */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
72 extern int SDL_GetTouchIndexId(SDL_TouchID id); |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
73 |
4677
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
4676
diff
changeset
|
74 /* Print a debug message for a nonexistent touch */ |
4678
f8431f66613d
Added SDL_TouchID, SDL_FingerID, SDL_GestureID types. Converted to integer cioordinates (<- not working).
jimtla
parents:
4677
diff
changeset
|
75 extern int SDL_TouchNotFoundError(SDL_TouchID id); |
4677
31607094315c
Added Iphone project. Iphone multi-touch is now functional.
jimtla
parents:
4676
diff
changeset
|
76 |
4640
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
77 #endif /* _SDL_touch_c_h */ |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
78 |
f068a6dfc858
Added SDL_touch.c/SDL_touch_c.h as slightly modifeind SDL_mouse*. Made reads in touchSimp non-blocking.
Jim Grandpre <jim.tla@gmail.com>
parents:
diff
changeset
|
79 /* vi: set ts=4 sw=4 expandtab: */ |