Normalized multitouch coords

This commit is contained in:
pelya
2011-12-06 17:47:14 +02:00
parent ef11ba725f
commit c3475c07c9
3 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -329,7 +329,7 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down,
//scale to Integer coordinates
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));
pressure = (Uint16)((pressurein+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
finger = SDL_GetFinger(touch,fingerid);
if(down) {
@@ -412,7 +412,7 @@ SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, int relative,
//scale to Integer coordinates
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));
pressure = (Uint16)((pressurein+touch->pressure_min)*(touch->pressureres)/(touch->native_pressureres));
if(touch->flush_motion) {
return 0;
}
@@ -1292,6 +1292,11 @@ extern void SDL_ANDROID_PumpEvents()
SDL_Event ev;
SDL_ANDROID_processAndroidTrackballDampening();
SDL_ANDROID_processMoveMouseWithKeyboard();
#if SDL_VERSION_ATLEAST(1,3,0)
SDL_Window * window = SDL_GetFocusWindow();
if( !window )
return;
#endif
if( !BufferedEventsMutex )
BufferedEventsMutex = SDL_CreateMutex();
@@ -1332,10 +1337,10 @@ extern void SDL_ANDROID_PumpEvents()
break;
#if SDL_VERSION_ATLEAST(1,3,0)
case SDL_FINGERMOTION:
SDL_SendTouchMotion(0, ev.tfinger.fingerId, 0, ev.tfinger.x, ev.tfinger.y, ev.tfinger.pressure);
SDL_SendTouchMotion(0, ev.tfinger.fingerId, 0, (float)ev.tfinger.x / (float)window->w, (float)ev.tfinger.y / (float)window->h, ev.tfinger.pressure);
break;
case SDL_FINGERDOWN:
SDL_SendFingerDown(0, ev.tfinger.fingerId, ev.tfinger.state ? 1 : 0, ev.tfinger.x, ev.tfinger.y, ev.tfinger.pressure);
SDL_SendFingerDown(0, ev.tfinger.fingerId, ev.tfinger.state ? 1 : 0, (float)ev.tfinger.x / (float)window->w, (float)ev.tfinger.y / (float)window->h, ev.tfinger.pressure);
break;
case SDL_TEXTINPUT:
SDL_SendKeyboardText(ev.text.text);
@@ -210,8 +210,8 @@ void ANDROID_GL_SwapBuffers(_THIS, SDL_Window * window)
if( SDL_ANDROID_InsideVideoThread() )
SDL_ANDROID_CallJavaSwapBuffers();
// SDL: 1.3 does not clear framebuffer before drawing
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
//glClearColor(0, 0, 0, 1);
//glClear(GL_COLOR_BUFFER_BIT);
};
SDL_GLContext ANDROID_GL_CreateContext(_THIS, SDL_Window * window)