21 #include "../SDL_internal.h" 28 #include "../video/SDL_sysvideo.h" 55 return SDL_touchDevices[
index]->
id;
65 touch = SDL_touchDevices[
index];
66 if (touch->
id ==
id) {
79 SDL_SetError(
"Unknown touch id %d, resetting", (
int)
id);
82 SDL_SetError(
"Unknown touch device id %d, cannot reset", (
int)
id);
86 return SDL_touchDevices[
index];
94 if (touch->
fingers[index]->
id == fingerid) {
153 SDL_touchDevices = touchDevices;
157 if (!SDL_touchDevices[index]) {
165 SDL_touchDevices[
index]->
id = touchID;
197 finger->
id = fingerid;
223 SDL_bool down,
float x,
float y,
float pressure)
248 event.tfinger.touchId =
id;
249 event.tfinger.fingerId = fingerid;
252 event.tfinger.dx = 0;
253 event.tfinger.dy = 0;
254 event.tfinger.pressure = pressure;
267 event.tfinger.touchId =
id;
268 event.tfinger.fingerId = fingerid;
270 event.tfinger.x = finger->
x;
271 event.tfinger.y = finger->
y;
272 event.tfinger.dx = 0;
273 event.tfinger.dy = 0;
274 event.tfinger.pressure = pressure;
285 float x,
float y,
float pressure)
290 float xrel, yrel, prel;
302 xrel = x - finger->
x;
303 yrel = y - finger->
y;
307 if (!xrel && !yrel && !prel) {
309 printf(
"Touch event didn't change state - dropped!\n");
324 event.tfinger.touchId =
id;
325 event.tfinger.fingerId = fingerid;
328 event.tfinger.dx = xrel;
329 event.tfinger.dy = yrel;
330 event.tfinger.pressure = pressure;
371 SDL_touchDevices =
NULL;
SDL_TouchID SDL_GetTouchDevice(int index)
Get the touch ID with the given index, or 0 if the index is invalid.
int SDL_GestureDelTouch(SDL_TouchID touchId)
GLint GLint GLint GLint GLint x
static int SDL_DelFinger(SDL_Touch *touch, SDL_FingerID fingerid)
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, float x, float y, float pressure)
static SDL_Finger * SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id)
static int SDL_GetTouchIndex(SDL_TouchID id)
GLuint const GLchar * name
int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, float x, float y, float pressure)
int SDL_GestureAddTouch(SDL_TouchID touchId)
#define SDL_GetEventState(type)
int SDL_GetNumTouchFingers(SDL_TouchID touchID)
Get the number of active fingers for a given touch device.
void SDL_DelTouch(SDL_TouchID id)
static int SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float y, float pressure)
GLint GLint GLint GLint GLint GLint y
int SDL_AddTouch(SDL_TouchID touchID, const char *name)
SDL_Finger * SDL_GetTouchFinger(SDL_TouchID touchID, int index)
Get the finger object of the given touch, with the given index.
void(* ResetTouch)(_THIS)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
#define SDL_assert(condition)
#define SDL_OutOfMemory()
SDL_VideoDevice * SDL_GetVideoDevice(void)
int SDL_GetNumTouchDevices(void)
Get the number of registered touch devices.
static SDL_Touch ** SDL_touchDevices
static int SDL_GetFingerIndex(const SDL_Touch *touch, SDL_FingerID fingerid)
SDL_Touch * SDL_GetTouch(SDL_TouchID id)