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]) {
156 SDL_touchDevices[
index]->
id = touchID;
188 finger->
id = fingerid;
214 SDL_bool down,
float x,
float y,
float pressure)
239 event.tfinger.touchId =
id;
240 event.tfinger.fingerId = fingerid;
243 event.tfinger.dx = 0;
244 event.tfinger.dy = 0;
245 event.tfinger.pressure = pressure;
258 event.tfinger.touchId =
id;
259 event.tfinger.fingerId = fingerid;
261 event.tfinger.x = finger->
x;
262 event.tfinger.y = finger->
y;
263 event.tfinger.dx = 0;
264 event.tfinger.dy = 0;
265 event.tfinger.pressure = pressure;
276 float x,
float y,
float pressure)
281 float xrel, yrel, prel;
293 xrel = x - finger->
x;
294 yrel = y - finger->
y;
298 if (!xrel && !yrel && !prel) {
300 printf(
"Touch event didn't change state - dropped!\n");
315 event.tfinger.touchId =
id;
316 event.tfinger.fingerId = fingerid;
319 event.tfinger.dx = xrel;
320 event.tfinger.dy = yrel;
321 event.tfinger.pressure = pressure;
359 SDL_touchDevices =
NULL;
DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event)
Add an event to the event queue.
DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size)
static int SDL_DelFinger(SDL_Touch *touch, SDL_FingerID fingerid)
DECLSPEC void SDLCALL SDL_free(void *mem)
int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down, float x, float y, float pressure)
EGLImageKHR EGLint * name
DECLSPEC SDL_Finger *SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index)
Get the finger object of the given touch, with the given index.
SDL_Finger * SDL_GetFinger(const SDL_Touch *touch, SDL_FingerID id)
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)
void SDL_DelTouch(SDL_TouchID id)
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
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)
#define SDL_assert(condition)
EGLSurface EGLint EGLint y
#define SDL_OutOfMemory()
DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID)
Get the number of active fingers for a given touch device.
DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index)
Get the touch ID with the given index, or 0 if the index is invalid.
DECLSPEC int SDLCALL 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)