comparison src/events/SDL_touch_c.h @ 4641:49a97daea6ec

Added touch event definitions. Heavily modified events/SDL_touch*.
author Jim Grandpre <jim.tla@gmail.com>
date Thu, 27 May 2010 01:21:37 -0400
parents f068a6dfc858
children 057e8762d2a1
comparison
equal deleted inserted replaced
4640:f068a6dfc858 4641:49a97daea6ec
23 23
24 #ifndef _SDL_touch_c_h 24 #ifndef _SDL_touch_c_h
25 #define _SDL_touch_c_h 25 #define _SDL_touch_c_h
26 26
27 typedef struct SDL_Touch SDL_Touch; 27 typedef struct SDL_Touch SDL_Touch;
28 typedef struct SDL_Finger SDL_Finger;
29
30 struct SDL_Finger {
31 int id;
32 int x;
33 int y;
34 int z; /* for future use */
35 int xdelta;
36 int ydelta;
37 int last_x, last_y; /* the last reported x and y coordinates */
38 int pressure;
39 };
28 40
29 41
30 struct SDL_Touch 42 struct SDL_Touch
31 { 43 {
32 /* Warp the touch to (x,y) */ 44
33 void (*WarpTouch) (SDL_Touch * touch, SDL_Window * window, int x, 45 /* Free the touch when it's time */
34 int y); 46 void (*FreeTouch) (SDL_Touch * touch);
47
48 /* data common for tablets */
49 int pressure_max;
50 int pressure_min;
51 int tilt; /* for future use */
52 int rotation; /* for future use */
53
54 int total_ends;
55 int current_end;
56
57 /* Data common to all touch */
58 int id;
59 SDL_Window *focus;
60
61 char *name;
62 Uint8 buttonstate;
63 SDL_bool relative_mode;
64 SDL_bool flush_motion;
35 65
36 /* Free the touch when it's time */ 66 int num_fingers;
37 void (*FreeTouch) (SDL_Touch * touch); 67 SDL_Finger** fingers;
68
69 void *driverdata;
70 };
38 71
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
72 /* Initialize the touch subsystem */ 73 /* Initialize the touch subsystem */
73 extern int SDL_TouchInit(void); 74 extern int SDL_TouchInit(void);
74 75
75 /* Get the touch at an index */ 76 /* Get the touch at an index */
82 int pressure_max, int pressure_min, int ends); 83 int pressure_max, int pressure_min, int ends);
83 84
84 /* Remove a touch at an index, clearing the slot for later */ 85 /* Remove a touch at an index, clearing the slot for later */
85 extern void SDL_DelTouch(int index); 86 extern void SDL_DelTouch(int index);
86 87
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 */ 88 /* Set the touch focus window */
91 extern void SDL_SetTouchFocus(int id, SDL_Window * window); 89 extern void SDL_SetTouchFocus(int id, SDL_Window * window);
92 90
93 /* Send a touch motion event for a touch */ 91 /* Send a touch motion event for a touch */
94 extern int SDL_SendTouchMotion(int id, int relative, int x, int y, int z); 92 extern int SDL_SendTouchMotion(int id, int fingerid,
93 int relative, int x, int y, int z);
95 94
96 /* Send a touch button event for a touch */ 95 /* Send a touch button event for a touch */
97 extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button); 96 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 97
105 /* Shutdown the touch subsystem */ 98 /* Shutdown the touch subsystem */
106 extern void SDL_TouchQuit(void); 99 extern void SDL_TouchQuit(void);
107 100
108 /* FIXME: Where do these functions go in this header? */ 101 /* FIXME: Where do these functions go in this header? */