Mercurial > sdl-ios-xcode
diff src/events/SDL_touch.c @ 4865:fff50e86c891
Update VS2010 project to add new files; update new files so code builds on Win32/Win64
author | Andreas Schiffler <aschiffler@ferzkopp.net> |
---|---|
date | Mon, 23 Aug 2010 23:44:28 -0700 |
parents | f9ab8df6d45a |
children | d6adaafcfb10 |
line wrap: on
line diff
--- a/src/events/SDL_touch.c Sun Aug 22 17:19:10 2010 -0700 +++ b/src/events/SDL_touch.c Mon Aug 23 23:44:28 2010 -0700 @@ -313,6 +313,11 @@ float xin, float yin, float pressurein) { int posted; + Uint16 x; + Uint16 y; + Uint16 pressure; + SDL_Finger *finger; + SDL_Touch* touch = SDL_GetTouch(id); if(!touch) { @@ -321,11 +326,11 @@ //scale to Integer coordinates - Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres); - Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres); - Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres); + x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres)); + y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres)); + pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres)); - SDL_Finger *finger = SDL_GetFinger(touch,fingerid); + finger = SDL_GetFinger(touch,fingerid); if(down) { if(finger == NULL) { SDL_Finger nf; @@ -393,15 +398,18 @@ int posted; Sint16 xrel, yrel; float x_max = 0, y_max = 0; + Uint16 x; + Uint16 y; + Uint16 pressure; if (!touch) { return SDL_TouchNotFoundError(id); } //scale to Integer coordinates - Uint16 x = (xin+touch->x_min)*(touch->xres)/(touch->native_xres); - Uint16 y = (yin+touch->y_min)*(touch->yres)/(touch->native_yres); - Uint16 pressure = (yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres); + x = (Uint16)((xin+touch->x_min)*(touch->xres)/(touch->native_xres)); + y = (Uint16)((yin+touch->y_min)*(touch->yres)/(touch->native_yres)); + pressure = (Uint16)((yin+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres)); if(touch->flush_motion) { return 0; } @@ -544,9 +552,9 @@ } int SDL_TouchNotFoundError(SDL_TouchID id) { + int i; printf("ERROR: Cannot send touch on non-existent device with id: %li make sure SDL_AddTouch has been called\n",id); printf("ERROR: There are %i touches installed with Id's:\n",SDL_num_touch); - int i; for(i=0;i < SDL_num_touch;i++) { printf("ERROR: %li\n",SDL_touchPads[i]->id); }