More incremental work on getting touch commands on Android. I've pinpointed a nasty problem that looks possibly like a compiler bug - the float values that are passed into SDL_SendFingerDown() are coming out junk on the other end. Probably an extra push of something on the stack, as when I tried using pointers to floats instead, the y value showed up in the x position.

This commit is contained in:
wrenczes@gmail.com
2011-06-07 16:43:44 +00:00
parent 4568f66a66
commit c859d35c0b
3 changed files with 52 additions and 28 deletions
+7 -2
View File
@@ -20,6 +20,8 @@
*/
#include "SDL_config.h"
#include <android/log.h>
/* General touch handling code for SDL */
#include "SDL_events.h"
@@ -324,11 +326,14 @@ SDL_SendFingerDown(SDL_TouchID id, SDL_FingerID fingerid, SDL_bool down,
return SDL_TouchNotFoundError(id);
}
//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));
char buffer[64];
sprintf(buffer, "Finger Down: xin: %g yin: %g x: %d y: %d", xin, yin, x, y);
__android_log_write(ANDROID_LOG_DEBUG, "Wagic", buffer);
finger = SDL_GetFinger(touch,fingerid);
if(down) {