# HG changeset patch # User Sam Lantinga # Date 1280633917 25200 # Node ID 5ee96ba0c01e367475ff5d71628839db3fe30feb # Parent f8431f66613d07d1a02d4e75202826b1a7a817fb Fixed various type and print format issues diff -r f8431f66613d -r 5ee96ba0c01e include/SDL_gesture.h --- a/include/SDL_gesture.h Sat Jul 31 20:02:54 2010 +0400 +++ b/include/SDL_gesture.h Sat Jul 31 20:38:37 2010 -0700 @@ -44,7 +44,7 @@ /* *INDENT-ON* */ #endif - typedef Uint64 SDL_GestureID; +typedef Sint64 SDL_GestureID; /* Function prototypes */ @@ -53,7 +53,7 @@ * * */ - extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); +extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId); /** @@ -61,15 +61,14 @@ * * */ - extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src); +extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *src); /** * \brief Save a currently loaded Dollar Gesture template * * */ - extern DECLSPEC int - SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src); +extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_RWops *src); /** @@ -77,9 +76,7 @@ * * */ - extern DECLSPEC - int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); - +extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src); /* Ends C function definitions when using C++ */ diff -r f8431f66613d -r 5ee96ba0c01e include/SDL_touch.h --- a/include/SDL_touch.h Sat Jul 31 20:02:54 2010 +0400 +++ b/include/SDL_touch.h Sat Jul 31 20:38:37 2010 -0700 @@ -42,8 +42,8 @@ #endif -typedef Uint64 SDL_TouchID; -typedef Uint64 SDL_FingerID; +typedef Sint64 SDL_TouchID; +typedef Sint64 SDL_FingerID; struct SDL_Finger { diff -r f8431f66613d -r 5ee96ba0c01e src/events/SDL_touch.c --- a/src/events/SDL_touch.c Sat Jul 31 20:02:54 2010 +0400 +++ b/src/events/SDL_touch.c Sat Jul 31 20:38:37 2010 -0700 @@ -393,7 +393,7 @@ 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); - printf("(%f,%f) --> (%i,%i)",xin,yin,x,y); + printf("(%f,%f) --> (%i,%i)\n",xin,yin,x,y); if(touch->flush_motion) { return 0; } diff -r f8431f66613d -r 5ee96ba0c01e src/video/cocoa/SDL_cocoawindow.m --- a/src/video/cocoa/SDL_cocoawindow.m Sat Jul 31 20:02:54 2010 +0400 +++ b/src/video/cocoa/SDL_cocoawindow.m Sat Jul 31 20:38:37 2010 -0700 @@ -315,7 +315,7 @@ if (SDL_AddTouch(&touch, "") < 0) { continue; } - printf("Success, added touch: %lin",touchId); + printf("Success, added touch: %li\n",touchId); } float x = [touch normalizedPosition].x; float y = [touch normalizedPosition].y; diff -r f8431f66613d -r 5ee96ba0c01e touchTest/gestureSDLTest.c --- a/touchTest/gestureSDLTest.c Sat Jul 31 20:02:54 2010 +0400 +++ b/touchTest/gestureSDLTest.c Sat Jul 31 20:38:37 2010 -0700 @@ -4,6 +4,28 @@ #include #include +/* Make sure we have good macros for printing 32 and 64 bit values */ +#ifndef PRIs32 +#define PRIs32 "d" +#endif +#ifndef PRIu32 +#define PRIu32 "u" +#endif +#ifndef PRIs64 +#ifdef __WIN32__ +#define PRIs64 "I64" +#else +#define PRIs64 "lld" +#endif +#endif +#ifndef PRIu64 +#ifdef __WIN32__ +#define PRIu64 "I64u" +#else +#define PRIu64 "llu" +#endif +#endif + #define PI 3.1415926535897 #define PHI ((sqrt(5)-1)/2) #define WIDTH 640 @@ -28,7 +50,7 @@ int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF}; -long index2fingerid[MAXFINGERS]; +SDL_FingerID index2fingerid[MAXFINGERS]; int fingersDown; typedef struct { @@ -38,7 +60,7 @@ typedef struct { Point p; float pressure; - long id; + SDL_FingerID id; } Finger; typedef struct { @@ -378,7 +400,7 @@ break; case SDL_FINGERDOWN: - printf("Finger: %li down - x: %f, y: %f\n",event.tfinger.fingerId, + printf("Finger: %"PRIs64" down - x: %i, y: %i\n",event.tfinger.fingerId, event.tfinger.x,event.tfinger.y); for(i = 0;i