Mercurial > sdl-ios-xcode
diff src/events/SDL_touch.c @ 4643:8806b78988f7
Bug fixes. Basic touch events (finger up, finger down, finger move) supported.
author | Jim Grandpre <jim.tla@gmail.com> |
---|---|
date | Sat, 29 May 2010 01:47:19 -0400 |
parents | 057e8762d2a1 |
children | fb500b3e1717 |
line wrap: on
line diff
--- a/src/events/SDL_touch.c Fri May 28 01:26:52 2010 -0400 +++ b/src/events/SDL_touch.c Sat May 29 01:47:19 2010 -0400 @@ -301,11 +301,12 @@ int SDL_SendFingerDown(int id, int fingerid, SDL_bool down, int x, int y, int pressure) { - int posted; + int posted; SDL_Touch* touch = SDL_GetTouch(id); + if(down) { SDL_Finger nf; - nf.id = id; + nf.id = fingerid; nf.x = x; nf.y = y; nf.pressure = pressure; @@ -324,13 +325,13 @@ event.tfinger.y = y; event.tfinger.state = touch->buttonstate; event.tfinger.windowID = touch->focus ? touch->focus->id : 0; - event.tfinger.fingerId = id; + event.tfinger.fingerId = fingerid; posted = (SDL_PushEvent(&event) > 0); } return posted; } else { - SDL_DelFinger(touch,id); + SDL_DelFinger(touch,fingerid); posted = 0; if (SDL_GetEventState(SDL_FINGERUP) == SDL_ENABLE) { SDL_Event event; @@ -338,7 +339,7 @@ event.tfinger.touchId = (Uint8) id; event.tfinger.state = touch->buttonstate; event.tfinger.windowID = touch->focus ? touch->focus->id : 0; - event.tfinger.fingerId = id; + event.tfinger.fingerId = fingerid; posted = (SDL_PushEvent(&event) > 0); } return posted; @@ -419,7 +420,8 @@ if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { SDL_Event event; event.tfinger.type = SDL_FINGERMOTION; - event.tfinger.touchId = (Uint8) index; + event.tfinger.touchId = (Uint8) id; + event.tfinger.fingerId = (Uint8) fingerid; event.tfinger.x = x; event.tfinger.y = y; event.tfinger.state = touch->buttonstate;