diff --git a/include/SDL_touch.h b/include/SDL_touch.h index 359748ccb..a8bff29a7 100644 --- a/include/SDL_touch.h +++ b/include/SDL_touch.h @@ -41,8 +41,6 @@ extern "C" { /* *INDENT-ON* */ #endif -typedef struct SDL_Touch SDL_Touch; -typedef struct SDL_Finger SDL_Finger; struct SDL_Finger { int id; @@ -55,9 +53,11 @@ struct SDL_Finger { int pressure; }; +typedef struct SDL_Touch SDL_Touch; +typedef struct SDL_Finger SDL_Finger; -struct SDL_Touch -{ + +struct SDL_Touch { /* Free the touch when it's time */ void (*FreeTouch) (SDL_Touch * touch); @@ -87,6 +87,7 @@ struct SDL_Touch }; + /* Function prototypes */ /** diff --git a/touchTest/touchTest.c b/touchTest/touchTest.c index b77a00e5c..66646af4f 100644 --- a/touchTest/touchTest.c +++ b/touchTest/touchTest.c @@ -3,6 +3,8 @@ #include #include + + #define PI 3.1415926535897 #define WIDTH 640 #define HEIGHT 480 @@ -32,7 +34,7 @@ Finger finger[MAXFINGERS]; void handler (int sig) { - printf ("\exiting...(%d)\n", sig); + printf ("exiting...(%d)\n", sig); exit (0); } @@ -81,7 +83,7 @@ void drawCircle(SDL_Surface* screen,int x,int y,int r,int c) void DrawScreen(SDL_Surface* screen, int h) { - int x, y, xm,ym,c; + int x, y, xm,ym,c,i; if(SDL_MUSTLOCK(screen)) { if(SDL_LockSurface(screen) < 0) return; @@ -98,9 +100,10 @@ void DrawScreen(SDL_Surface* screen, int h) setpix(screen,x,y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255); } } + drawCircle(screen,mousx,mousy,-30,0xFFFFFF); - int i; + for(i=0;i= 0 && finger[i].p.y >= 0) if(finger[i].pressure > 0) @@ -131,8 +134,8 @@ int main(int argc, char* argv[]) memset(keystat,0,512*sizeof(keystat[0])); if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1; - - if (!(screen = initScreen(WIDTH,HEIGHT))) + screen = initScreen(WIDTH,HEIGHT); + if (!screen) { SDL_Quit(); return 1; @@ -179,21 +182,22 @@ int main(int argc, char* argv[]) ; //printf("Finger: %i,x: %i, y: %i\n",event.tfinger.fingerId, // event.tfinger.x,event.tfinger.y); - SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId); - SDL_Finger* inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId); - + //SDL_Touch *inTouch = SDL_GetTouch(event.tfinger.touchId); + //SDL_Finger *inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId); + /* finger[event.tfinger.fingerId].p.x = ((float)event.tfinger.x)/ inTouch->xres; finger[event.tfinger.fingerId].p.y = ((float)event.tfinger.y)/ inTouch->yres; finger[event.tfinger.fingerId].pressure = - ((float)event.tfinger.pressure)/inTouch->pressureres; - + ((float)event.tfinger.pressure)/inTouch->pressureres;*/ + /* printf("Finger: %i, Pressure: %f Pressureres: %i\n", event.tfinger.fingerId, finger[event.tfinger.fingerId].pressure, inTouch->pressureres); + */ //printf("Finger: %i, pressure: %f\n",event.tfinger.fingerId, // finger[event.tfinger.fingerId].pressure); diff --git a/touchTest/touchTest2/touchTest2.ncb b/touchTest/touchTest2/touchTest2.ncb new file mode 100644 index 000000000..284832a93 Binary files /dev/null and b/touchTest/touchTest2/touchTest2.ncb differ diff --git a/touchTest/touchTest2/touchTest2.sln b/touchTest/touchTest2/touchTest2.sln new file mode 100644 index 000000000..ff88fc843 --- /dev/null +++ b/touchTest/touchTest2/touchTest2.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "touchTest2", "touchTest2\touchTest2.vcproj", "{42BC83F1-CF20-4CEC-AC81-12EA804639E2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Debug|Win32.ActiveCfg = Debug|Win32 + {42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Debug|Win32.Build.0 = Debug|Win32 + {42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Release|Win32.ActiveCfg = Release|Win32 + {42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/touchTest/touchTest2/touchTest2.suo b/touchTest/touchTest2/touchTest2.suo new file mode 100644 index 000000000..5e9378cc7 Binary files /dev/null and b/touchTest/touchTest2/touchTest2.suo differ diff --git a/touchTest/touchTest2/touchTest2/SDL.dll b/touchTest/touchTest2/touchTest2/SDL.dll new file mode 100644 index 000000000..73ca7fdd1 Binary files /dev/null and b/touchTest/touchTest2/touchTest2/SDL.dll differ diff --git a/touchTest/touchTest2/touchTest2/touchTest2.vcproj b/touchTest/touchTest2/touchTest2/touchTest2.vcproj new file mode 100644 index 000000000..8e06459d5 --- /dev/null +++ b/touchTest/touchTest2/touchTest2/touchTest2.vcproj @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/touchTest/touchTest2/touchTest2/touchTest2.vcproj.jgran-virtualPC.jgran.user b/touchTest/touchTest2/touchTest2/touchTest2.vcproj.jgran-virtualPC.jgran.user new file mode 100644 index 000000000..33a91896e --- /dev/null +++ b/touchTest/touchTest2/touchTest2/touchTest2.vcproj.jgran-virtualPC.jgran.user @@ -0,0 +1,65 @@ + + + + + + + + + + +