21 #include "../SDL_internal.h" 54 return SDL_touchDevices[
index]->
id;
64 touch = SDL_touchDevices[
index];
65 if (touch->
id ==
id) {
80 return SDL_touchDevices[
index];
88 if (touch->
fingers[index]->
id == fingerid) {
147 SDL_touchDevices = touchDevices;
151 if (!SDL_touchDevices[index]) {
159 SDL_touchDevices[
index]->
id = touchID;
191 finger->
id = fingerid;
217 SDL_bool down,
float x,
float y,
float pressure)
242 event.tfinger.touchId =
id;
243 event.tfinger.fingerId = fingerid;
246 event.tfinger.dx = 0;
247 event.tfinger.dy = 0;
248 event.tfinger.pressure = pressure;
261 event.tfinger.touchId =
id;
262 event.tfinger.fingerId = fingerid;
264 event.tfinger.x = finger->
x;
265 event.tfinger.y = finger->
y;
266 event.tfinger.dx = 0;
267 event.tfinger.dy = 0;
268 event.tfinger.pressure = pressure;
279 float x,
float y,
float pressure)
284 float xrel, yrel, prel;
296 xrel = x - finger->
x;
297 yrel = y - finger->
y;
301 if (!xrel && !yrel && !prel) {
303 printf(
"Touch event didn't change state - dropped!\n");
318 event.tfinger.touchId =
id;
319 event.tfinger.fingerId = fingerid;
322 event.tfinger.dx = xrel;
323 event.tfinger.dy = yrel;
324 event.tfinger.pressure = pressure;
362 SDL_touchDevices =
NULL;
SDL_TouchID SDL_GetTouchDevice(int index)
Get the touch ID with the given index, or 0 if the index is invalid.
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)
SDL_Finger * SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id)
GLuint const GLchar * name
GLint GLint GLint GLint GLint x
static int SDL_GetTouchIndex(SDL_TouchID id)
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)
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.
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()
GLint GLint GLint GLint GLint GLint y
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)