From 42b369812e39f40fb36ca54b95d80dc1e19b2296 Mon Sep 17 00:00:00 2001 From: Jim Grandpre Date: Sun, 11 Jul 2010 01:15:39 -0400 Subject: [PATCH] Added some files I had previosuly missed --- Makefile.in | 2 +- include/SDL_events.h | 6 +- include/SDL_gesture.h | 90 ++++++++++ include/SDL_touch.h | 2 +- src/events/SDL_gesture.c | 200 ++++++++++++++++++++-- src/events/SDL_gesture_c.h | 1 + touchTest/gestureSDLTest.c | 334 ++++--------------------------------- touchTest/touchPong | Bin 29683 -> 29723 bytes touchTest/touchSimp | Bin 29492 -> 29536 bytes 9 files changed, 316 insertions(+), 319 deletions(-) create mode 100644 include/SDL_gesture.h diff --git a/Makefile.in b/Makefile.in index bd8db1e4f..a613eb2ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,7 +44,7 @@ EMBEDSPU = @EMBEDSPU@ DIST = acinclude autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS include INSTALL Makefile.minimal Makefile.in README* sdl-config.in sdl.m4 sdl.pc.in SDL.spec SDL.spec.in src test TODO VisualC.html VisualC VisualCE Watcom-Win32.zip WhatsNew Xcode Xcode-iPhoneOS -HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h SDL_touch.h +HDRS = SDL.h SDL_assert.h SDL_atomic.h SDL_audio.h SDL_compat.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_haptic.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_opengles.h SDL_pixels.h SDL_platform.h SDL_power.h SDL_quit.h SDL_rect.h SDL_revision.h SDL_rwops.h SDL_scancode.h SDL_stdinc.h SDL_surface.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h SDL_touch.h SDL_gesture.h LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ diff --git a/include/SDL_events.h b/include/SDL_events.h index 2cd0cc69a..82fca7922 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -36,6 +36,8 @@ #include "SDL_mouse.h" #include "SDL_joystick.h" #include "SDL_quit.h" +#include "SDL_gesture.h" +#include "SDL_touch.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -95,6 +97,7 @@ typedef enum /*Gesture events*/ SDL_DOLLARGESTURE = 0x800, + SDL_DOLLARRECORD, SDL_MULTIGESTURE, /* Obsolete events */ @@ -359,9 +362,10 @@ typedef struct SDL_DollarGestureEvent Uint32 type; /**< ::SDL_DOLLARGESTURE */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint8 touchId; /**< The touch device index */ - Uint8 gestureId; + Uint8 padding1; Uint8 padding2; Uint8 padding3; + unsigned long gestureId; float error; /* //TODO: Enable to give location? diff --git a/include/SDL_gesture.h b/include/SDL_gesture.h new file mode 100644 index 000000000..cade7d13e --- /dev/null +++ b/include/SDL_gesture.h @@ -0,0 +1,90 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ + +/** + * \file SDL_gesture.h + * + * Include file for SDL gesture event handling. + */ + +#ifndef _SDL_gesture_h +#define _SDL_gesture_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + + +/* Function prototypes */ + +/** + * \brief Begin Recording a gesture on the specified touch, or all touches (-1) + * + * + */ + extern DECLSPEC int SDLCALL SDL_RecordGesture(int touchId); + + +/** + * \brief Save all currently loaded Dollar Gesture templates + * + * + */ + extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(FILE *fp); + +/** + * \brief Save a currently loaded Dollar Gesture template + * + * + */ + extern DECLSPEC int + SDLCALL SDL_SaveDollarTemplate(unsigned long gestureId,FILE *fp); + + +/** + * \brief Load Dollar Gesture templates from a file + * + * + */ + extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(int touchId, FILE *fp); + + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_gesture_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/include/SDL_touch.h b/include/SDL_touch.h index ce50b4221..c1a98a129 100644 --- a/include/SDL_touch.h +++ b/include/SDL_touch.h @@ -23,7 +23,7 @@ /** * \file SDL_touch.h * - * Include file for SDL mouse event handling. + * Include file for SDL touch event handling. */ #ifndef _SDL_touch_h diff --git a/src/events/SDL_gesture.c b/src/events/SDL_gesture.c index 107f64611..b80717fe7 100644 --- a/src/events/SDL_gesture.c +++ b/src/events/SDL_gesture.c @@ -13,8 +13,7 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + License along with this library; if not, write to the Free Software Founation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org @@ -66,6 +65,10 @@ typedef struct { DollarPath dollarPath; } TouchPoint; +typedef struct { + Point path[DOLLARNPOINTS]; + unsigned long hash; +} DollarTemplate; typedef struct { int id; @@ -75,11 +78,140 @@ typedef struct { int numDownFingers; int numDollarTemplates; - Point dollarTemplate[MAXTEMPLATES][DOLLARNPOINTS]; + DollarTemplate dollarTemplate[MAXTEMPLATES]; + + SDL_bool recording; } GestureTouch; GestureTouch gestureTouch[MAXTOUCHES]; int numGestureTouches = 0; +SDL_bool recordAll; + +int SDL_RecordGesture(int touchId) { + int i; + if(touchId < 0) recordAll = SDL_TRUE; + for(i = 0;i < numGestureTouches; i++) { + if((touchId < 0) || (gestureTouch[i].id == touchId)) { + gestureTouch[i].recording = SDL_TRUE; + if(touchId >= 0) + return 1; + } + } + return (touchId < 0); +} + +unsigned long SDL_HashDollar(Point* points) { + unsigned long hash = 5381; + int i; + for(i = 0;i < DOLLARNPOINTS; i++) { + hash = ((hash<<5) + hash) + points[i].x; + hash = ((hash<<5) + hash) + points[i].y; + } + return hash; +} + +int SaveTemplate(DollarTemplate *templ, FILE *fp) { + int i; + fprintf(fp,"%lu ",templ->hash); + for(i = 0;i < DOLLARNPOINTS;i++) { + fprintf(fp,"%i %i ",(int)templ->path[i].x,(int)templ->path[i].y); + } + fprintf(fp,"\n"); +} + + +int SDL_SaveAllDollarTemplates(FILE *fp) { + int i,j,rtrn = 0; + for(i = 0; i < numGestureTouches; i++) { + GestureTouch* touch = &gestureTouch[i]; + for(j = 0;j < touch->numDollarTemplates; j++) { + rtrn += SaveTemplate(&touch->dollarTemplate[i],fp); + } + } + return rtrn; +} + +int SDL_SaveDollarTemplate(unsigned long gestureId, FILE *fp) { + int i,j; + for(i = 0; i < numGestureTouches; i++) { + GestureTouch* touch = &gestureTouch[i]; + for(j = 0;j < touch->numDollarTemplates; j++) { + if(touch->dollarTemplate[i].hash == gestureId) { + return SaveTemplate(&touch->dollarTemplate[i],fp); + } + } + } +} + +int SDL_LoadDollarTemplates(int touchId, FILE *fp) { + int i,loaded = 0; + GestureTouch *touch = NULL; + if(touchId >= 0) { + for(i = 0;i < numGestureTouches; i++) + if(gestureTouch[i].id == touchId) + touch = &gestureTouch[i]; + if(touch == NULL) return -1; + } + + while(!feof(fp)) { + DollarTemplate templ; + fscanf(fp,"%lu ",&templ.hash); + for(i = 0;i < DOLLARNPOINTS; i++) { + int x,y; + if(fscanf(fp,"%i %i ",&x,&y) != 2) break; + templ.path[i].x = x; + templ.path[i].y = y; + } + fscanf(fp,"\n"); + + if(touchId >= 0) { + if(SDL_AddDollarGesture(touch,templ)) loaded++; + } + else { + for(i = 0;i < numGestureTouches; i++) { + if(gestureTouch[i].id == touchId) { + touch = &gestureTouch[i]; + SDL_AddDollarGesture(touch,templ); + } + } + loaded++; + } + } + + return 1; +} + + +//path is an already sampled set of points +//Returns the index of the gesture on success, or -1 +int SDL_AddDollarGesture(GestureTouch* inTouch,Point* path) { + if(inTouch == NULL) { + if(numGestureTouches == 0) return -1; + int i = 0; + for(i = 0;i < numGestureTouches; i++) { + inTouch = &gestureTouch[i]; + if(inTouch->numDollarTemplates < MAXTEMPLATES) { + DollarTemplate *templ = + &inTouch->dollarTemplate[inTouch->numDollarTemplates]; + memcpy(templ->path,path,DOLLARNPOINTS*sizeof(Point)); + templ->hash = SDL_HashDollar(templ->path); + inTouch->numDollarTemplates++; + } + } + return inTouch->numDollarTemplates - 1; + }else if(inTouch->numDollarTemplates < MAXTEMPLATES) { + DollarTemplate *templ = + &inTouch->dollarTemplate[inTouch->numDollarTemplates]; + memcpy(templ->path,path,DOLLARNPOINTS*sizeof(Point)); + templ->hash = SDL_HashDollar(templ->path); + inTouch->numDollarTemplates++; + return inTouch->numDollarTemplates - 1; + } + return -1; +} + + + float dollarDifference(Point* points,Point* templ,float ang) { // Point p[DOLLARNPOINTS]; @@ -141,7 +273,7 @@ float dollarRecognize(DollarPath path,int *bestTempl,GestureTouch* touch) { int bestDiff = 10000; *bestTempl = -1; for(i = 0;i < touch->numDollarTemplates;i++) { - int diff = bestDollarDifference(points,touch->dollarTemplate[i]); + int diff = bestDollarDifference(points,touch->dollarTemplate[i].path); if(diff < bestDiff) {bestDiff = diff; *bestTempl = i;} } return bestDiff; @@ -239,6 +371,8 @@ int SDL_GestureAddTouch(SDL_Touch* touch) { gestureTouch[numGestureTouches].numDollarTemplates = 0; + gestureTouch[numGestureTouches].recording = SDL_FALSE; + numGestureTouches++; return 0; } @@ -277,6 +411,17 @@ int SDL_SendGestureDollar(GestureTouch* touch,int gestureId,float error) { return SDL_PushEvent(&event) > 0; } + +int SDL_SendDollarRecord(GestureTouch* touch,int gestureId) { + SDL_Event event; + event.dgesture.type = SDL_DOLLARRECORD; + event.dgesture.touchId = touch->id; + event.dgesture.gestureId = gestureId; + + return SDL_PushEvent(&event) > 0; +} + + void SDL_GestureProcessEvent(SDL_Event* event) { if(event->type == SDL_FINGERMOTION || @@ -294,23 +439,44 @@ void SDL_GestureProcessEvent(SDL_Event* event) for(j = 0;jnumDownFingers;j++) { if(inTouch->gestureLast[j].f.id != event->tfinger.fingerId) continue; - + //Finger Up if(event->type == SDL_FINGERUP) { inTouch->numDownFingers--; - int bestTempl; - float error; - error = dollarRecognize(inTouch->gestureLast[j].dollarPath, - &bestTempl,inTouch); - if(bestTempl >= 0){ - //Send Event - int gestureId = 0; //? - SDL_SendGestureDollar(inTouch->id,gestureId,error); - - - printf("Dollar error: %f\n",error); + if(inTouch->recording) { + inTouch->recording = SDL_FALSE; + Point path[DOLLARNPOINTS]; + dollarNormalize(inTouch->gestureLast[j].dollarPath,path); + int index; + if(recordAll) { + index = SDL_AddDollarGesture(NULL,path); + int i; + for(i = 0;i < numGestureTouches; i++) + gestureTouch[i].recording = SDL_FALSE; + } + else { + index = SDL_AddDollarGesture(inTouch,path); + } + + if(index >= 0) { + SDL_SendDollarRecord(inTouch,inTouch->dollarTemplate[index].hash); + } + else { + SDL_SendDollarRecord(inTouch,-1); + } } - + else { + int bestTempl; + float error; + error = dollarRecognize(inTouch->gestureLast[j].dollarPath, + &bestTempl,inTouch); + if(bestTempl >= 0){ + //Send Event + int gestureId = inTouch->dollarTemplate[bestTempl].hash; + SDL_SendGestureDollar(inTouch,gestureId,error); + printf("Dollar error: %f\n",error); + } + } inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers]; break; } diff --git a/src/events/SDL_gesture_c.h b/src/events/SDL_gesture_c.h index b6513e5cc..99e462a87 100644 --- a/src/events/SDL_gesture_c.h +++ b/src/events/SDL_gesture_c.h @@ -26,6 +26,7 @@ extern void SDL_GestureProcessEvent(SDL_Event* event); +extern int SDL_RecordGesture(int touchId); #endif /* _SDL_gesture_c_h */ diff --git a/touchTest/gestureSDLTest.c b/touchTest/gestureSDLTest.c index cedb14205..a917ed798 100644 --- a/touchTest/gestureSDLTest.c +++ b/touchTest/gestureSDLTest.c @@ -2,6 +2,7 @@ #include #include #include +#include #define PI 3.1415926535897 #define PHI ((sqrt(5)-1)/2) @@ -159,171 +160,6 @@ void drawKnob(SDL_Surface* screen,Knob k) { } -void drawDollarPath(SDL_Surface* screen,Point* points,int numPoints, - int rad,unsigned int col){ - int i; - for(i=0;iw/2, - points[i].y+screen->h/2, - rad,col); - } -} - -float dollarDifference(Point* points,Point* templ,float ang) { - // Point p[DOLLARNPOINTS]; - float dist = 0; - Point p; - int i; - for(i = 0; i < DOLLARNPOINTS; i++) { - p.x = points[i].x * cos(ang) - points[i].y * sin(ang); - p.y = points[i].x * sin(ang) + points[i].y * cos(ang); - dist += sqrt((p.x-templ[i].x)*(p.x-templ[i].x)+ - (p.y-templ[i].y)*(p.y-templ[i].y)); - } - return dist/DOLLARNPOINTS; - -} - -float bestDollarDifference(Point* points,Point* templ) { - //------------BEGIN DOLLAR BLACKBOX----------------// - //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-// - //-"http://depts.washington.edu/aimgroup/proj/dollar/"-// - float ta = -PI/4; - float tb = PI/4; - float dt = PI/90; - float x1 = PHI*ta + (1-PHI)*tb; - float f1 = dollarDifference(points,templ,x1); - float x2 = (1-PHI)*ta + PHI*tb; - float f2 = dollarDifference(points,templ,x2); - while(abs(ta-tb) > dt) { - if(f1 < f2) { - tb = x2; - x2 = x1; - f2 = f1; - x1 = PHI*ta + (1-PHI)*tb; - f1 = dollarDifference(points,templ,x1); - } - else { - ta = x1; - x1 = x2; - f1 = f2; - x2 = (1-PHI)*ta + PHI*tb; - f2 = dollarDifference(points,templ,x2); - } - } - /* - if(f1 <= f2) - printf("Min angle (x1): %f\n",x1); - else if(f1 > f2) - printf("Min angle (x2): %f\n",x2); - */ - return SDL_min(f1,f2); -} - -float dollarRecognize(SDL_Surface* screen, DollarPath path,int *bestTempl) { - - Point points[DOLLARNPOINTS]; - int numPoints = dollarNormalize(path,points); - int i; - - int k; - /* - for(k = 0;k interval) { - points[numPoints].x = path.p[i-1].x + - ((interval-dist)/d)*(path.p[i].x-path.p[i-1].x); - points[numPoints].y = path.p[i-1].y + - ((interval-dist)/d)*(path.p[i].y-path.p[i-1].y); - centroid.x += points[numPoints].x; - centroid.y += points[numPoints].y; - numPoints++; - - dist -= interval; - } - dist += d; - } - if(numPoints < 1) return 0; - centroid.x /= numPoints; - centroid.y /= numPoints; - - //printf("Centroid (%f,%f)",centroid.x,centroid.y); - //Rotate Points so point 0 is left of centroid and solve for the bounding box - float xmin,xmax,ymin,ymax; - xmin = centroid.x; - xmax = centroid.x; - ymin = centroid.y; - ymax = centroid.y; - - float ang = atan2(centroid.y - points[0].y, - centroid.x - points[0].x); - - for(i = 0;i xmax) xmax = points[i].x; - if(points[i].y < ymin) ymin = points[i].y; - if(points[i].y > ymax) ymax = points[i].y; - } - - //Scale points to DOLLARSIZE, and translate to the origin - float w = xmax-xmin; - float h = ymax-ymin; - - for(i=0;ixres; - float y = ((float)event.tfinger.y)/inTouch->yres; - int j,empty = -1; - - for(j = 0;j= 0){ - drawDollarPath(screen,dollarTemplate[bestTempl] - ,DOLLARNPOINTS,-15,0x0066FF); - printf("Dollar error: %f\n",error); - } - - } - else if(numDollarTemplates < MAXTEMPLATES) { - - dollarNormalize(dollarPath[j], - dollarTemplate[numDollarTemplates]); - /* - int k; - for(k = 0;k 1) { - Point lv; //Vector from centroid to last x,y position - Point v; //Vector from centroid to current x,y position - lv.x = gestureLast[j].cv.x; - lv.y = gestureLast[j].cv.y; - float lDist = sqrt(lv.x*lv.x + lv.y*lv.y); - - v.x = x - centroid.x; - v.y = y - centroid.y; - gestureLast[j].cv = v; - float Dist = sqrt(v.x*v.x+v.y*v.y); - // cos(dTheta) = (v . lv)/(|v| * |lv|) - - lv.x/=lDist; - lv.y/=lDist; - v.x/=Dist; - v.y/=Dist; - float dtheta = atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y); - - float dDist = (lDist - Dist); - - gestureLast[j].dDist = dDist; - gestureLast[j].dtheta = dtheta; - - //gdtheta = gdtheta*.9 + dtheta*.1; - //gdDist = gdDist*.9 + dDist*.1 - gdtheta += dtheta; - gdDist += dDist; - - //printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist); - //printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist); - } - else { - gestureLast[j].dDist = 0; - gestureLast[j].dtheta = 0; - gestureLast[j].cv.x = 0; - gestureLast[j].cv.y = 0; - } - gestureLast[j].f.p.x = x; - gestureLast[j].f.p.y = y; - break; - //pressure? - } - } - else if(gestureLast[j].f.id == -1 && empty == -1) { - empty = j; - } - } - - if(j >= MAXFINGERS && empty >= 0) { - // printf("Finger Down!!!\n"); - numDownFingers++; - centroid.x = (centroid.x*(numDownFingers - 1) + x)/numDownFingers; - centroid.y = (centroid.y*(numDownFingers - 1) + y)/numDownFingers; - - j = empty; - gestureLast[j].f.id = event.tfinger.fingerId; - gestureLast[j].f.p.x = x; - gestureLast[j].f.p.y = y; - - - dollarPath[j].length = 0; - dollarPath[j].p[0].x = x; - dollarPath[j].p[0].y = y; - dollarPath[j].numPoints = 1; - } + float y = ((float)event.tfinger.y)/inTouch->yres; //draw the touch: - if(gestureLast[j].f.id < 0) continue; //Finger up. Or some error... - - unsigned int c = colors[gestureLast[j].f.id%7]; + unsigned int c = colors[event.tfinger.touchId%7]; unsigned int col = ((unsigned int)(c*(.1+.85))) | ((unsigned int)((0xFF*(1-((float)age)/EVENT_BUF_SIZE))) & 0xFF)<<24; - x = gestureLast[j].f.p.x; - y = gestureLast[j].f.p.y; + if(event.type == SDL_FINGERMOTION) drawCircle(screen,x*screen->w,y*screen->h,5,col); else if(event.type == SDL_FINGERDOWN) drawCircle(screen,x*screen->w,y*screen->h,-10,col); - + /* //if there is a centroid, draw it if(numDownFingers > 1) { unsigned int col = @@ -508,6 +226,7 @@ void DrawScreen(SDL_Surface* screen, int h) ((unsigned int)((0xFF*(1-((float)age)/EVENT_BUF_SIZE))) & 0xFF)<<24; drawCircle(screen,centroid.x*screen->w,centroid.y*screen->h,5,col); } + */ } } @@ -582,6 +301,22 @@ int main(int argc, char* argv[]) case SDL_KEYDOWN: //printf("%i\n",event.key.keysym.sym); keystat[event.key.keysym.sym] = 1; + if(event.key.keysym.sym == 32) { + SDL_RecordGesture(-1); + } + else if(event.key.keysym.sym == 115) { + FILE *fp; + fp = fopen("gestureSave","w"); + SDL_SaveAllDollarTemplates(fp); + fclose(fp); + } + else if(event.key.keysym.sym == 108) { + FILE *fp; + fp = fopen("gestureSave","r"); + printf("Loaded: %i\n",SDL_LoadDollarTemplates(-1,fp)); + fclose(fp); + } + //keypress = 1; break; case SDL_KEYUP: @@ -665,20 +400,21 @@ int main(int argc, char* argv[]) knob.p.y = event.mgesture.y; knob.ang += event.mgesture.dTheta; knob.r += event.mgesture.dDist; + break; + case SDL_DOLLARGESTURE: + printf("Gesture %lu performed, error: %f\n", + event.dgesture.gestureId, + event.dgesture.error); + break; + case SDL_DOLLARRECORD: + printf("Recorded gesture: %lu\n",event.dgesture.gestureId); + break; } - - - - //And draw - } - DrawScreen(screen,h); - //printf("c: (%f,%f)\n",centroid.x,centroid.y); - //printf("numDownFingers: %i\n",numDownFingers); - //for(i=0;i<512;i++) - // if(keystat[i]) printf("%i\n",i); - - + DrawScreen(screen,h); + for(i = 0; i < 256; i++) + if(keystat[i]) + printf("Key %i down\n",i); } SDL_Quit(); diff --git a/touchTest/touchPong b/touchTest/touchPong index b398f5a1a281e9056775f9523110a62da29f6965..c169a17c075ba12b0fec4fc5dfebea900bf76858 100755 GIT binary patch delta 4373 zcmY*c3wTt;6+UO#C3}-SyLXe_JV-($0g^z#P>@0%XiT&k6_g15lu{ZYkjs#&zXDg%FXv>Xa2c&&i|h? zXU@$1;xyiW2G?ES@i#n`KN%yBo!xUL+S$H(_Qq((o1Z2(=5JZj-PM5u^5RQ!0M=y! zG}X5@v^2IsH}~f?wzbV|o7T9fIR+;g&u@&)YhDDCvj7^}>K9fwx6Np2gk2147}m{b zYiw+VG5r9VTbpAxY-2d5zPS~SWpiilg87T!6T7zQ?6UQA;jBU+Q6ZlIWfgfS>YG0Swv`1W2Yy>`V#-yh)dBLI5gO zXYcu=t?DMw`tUV|&uLxbz^S@qT6rT7mOE3C?Un9Yo$qe%c4Q8xjMrei$v zQ<~xj7(<_`w+icUrz$Ec#X5CEQ8xBh3yO-zFJKoA13k#7R`5M*4vpg%oD7zeD;hKf4EM2&3O4RdVwOq-)i6L$Yzbnlq%- zlaj3-7;<6!RbGbeNL}3g1?gtiy#r}S20%Abh8JKb(uXW+7gAqd)@P75GI|#2Np5x{ zy}-?LNN;k}gOtf4pGW$Z(F;i9SkN9MUw?oXkv`$b>_z%48DJk$35Rz-(kyk&(9%#k zzxW!`Fix1)k$P3f&{8Z{yNBL5@NU-q5z>`B=`_+Bj`4C2{U!}yg@<->v(iIbRC!5u z`dNOo+C!6l0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gL~6eRqnPtH%!3cbnKk zy{|pT`mzx-Yh)+mprzOXy$ZWnA9t~ydh33k_vrmMwoGrTyUg|*dqO|&HrrtAdmU(x z*{x!=$WGa7@*uVznISKjsgAv-gYM%&7(pyeXa9cIM_Ft(6w2Ss9u%w7LSHm1J~mFj z^Af*~5V2ptwYVHG2_8G4v*NIsh}dvk>*a`XlcL%ed7Te{A+Q^{5Y8EZObOf%ap63D zpah42%Z|h@g>e?!GxMnaPRFT1jA^rXARR6R}oj-U&-&WYbjjW>#Sndyw$Ny0<=nw1s|6<~}QIE{G zlJaM(or8Oq>e1$(ts7drhDL*QgRi}?u<-`sX%DM#ZQZ~}pr5b*3mUq$9}gCEhjBdP zc7*HJ{$jAeXztL&-P&IW7U+))UVc(7s$CUJK}X#!y#+5{L}?u;x>Ua*1LFFdzPqmd zk*TN-slXW@po#-SJ|i;i*#Gm)rSfg0i{_X=mGck4VhvEB&g5Bso~RyeD&g&F vUsEZ!sL%0xQsp(51`ZA-x=oE}F5xk%xw#Zysw?q(P;J8RwVfxLYtsG)^3AjT diff --git a/touchTest/touchSimp b/touchTest/touchSimp index bbbd1353406ad66234d780e59607598bbabb99c0..2249aaef1a6aa4d3d181eb6905ef08307ed21b39 100755 GIT binary patch delta 4312 zcmY*c33L=y7JaYNO}dhP>FT75BqSk(0D&Y(7)7!H25`oSNEAjnvYJ3J0SuS~0cV&7 z1cp__uOh2DGv_!is7$LYA}Gir%AyXdC@2c!IXa8V$aoGq@BOOkp>j_8|65i6-TUu< z|NW|0FXH)&_(&I=y`^9jMl)X9_0;B7CkO93x$fN6=$6Yf=Iz=UUx5Yru|c^2k7NNf z)wfKV*4PT$xId$@wRL*ygvQy;?QouPTVwl-=GkypHo&CT`dLGoTPIFygdGfrG8{Rv zwXv}U$~yrxw=}mqu$AF`_027?H-|gZXSU6T<4$i5T;bl-#yM^6^_|-xg%vb#w|!eGUbn6EAu48|*}yz3NtfMW${avnej z+OA&inrYUtuv7^7lW*RH092?>bS=llDqQ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