comparison touchTest/gestureSDLTest.c @ 4676:99b4560b7aa1

Upgraded touchId/fingerId to long. Changed position variables to floats.
author jimtla
date Fri, 30 Jul 2010 23:18:35 +0400
parents 317a151b79ad
children 5ee96ba0c01e
comparison
equal deleted inserted replaced
4675:641c13b0ce5f 4676:99b4560b7aa1
26 int keystat[512]; 26 int keystat[512];
27 int bstatus; 27 int bstatus;
28 28
29 int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF}; 29 int colors[7] = {0xFF,0xFF00,0xFF0000,0xFFFF00,0x00FFFF,0xFF00FF,0xFFFFFF};
30 30
31 int index2fingerid[MAXFINGERS]; 31 long index2fingerid[MAXFINGERS];
32 int fingersDown; 32 int fingersDown;
33 33
34 typedef struct { 34 typedef struct {
35 float x,y; 35 float x,y;
36 } Point; 36 } Point;
37 37
38 typedef struct { 38 typedef struct {
39 Point p; 39 Point p;
40 float pressure; 40 float pressure;
41 int id; 41 long id;
42 } Finger; 42 } Finger;
43 43
44 typedef struct { 44 typedef struct {
45 Finger f; 45 Finger f;
46 Point cv; 46 Point cv;
376 // finger[event.tfinger.fingerId].pressure); 376 // finger[event.tfinger.fingerId].pressure);
377 } 377 }
378 378
379 break; 379 break;
380 case SDL_FINGERDOWN: 380 case SDL_FINGERDOWN:
381 printf("Finger: %i down - x: %i, y: %i\n",event.tfinger.fingerId, 381 printf("Finger: %li down - x: %f, y: %f\n",event.tfinger.fingerId,
382 event.tfinger.x,event.tfinger.y); 382 event.tfinger.x,event.tfinger.y);
383 383
384 for(i = 0;i<MAXFINGERS;i++) 384 for(i = 0;i<MAXFINGERS;i++)
385 if(index2fingerid[i] == -1) { 385 if(index2fingerid[i] == -1) {
386 index2fingerid[i] = event.tfinger.fingerId; 386 index2fingerid[i] = event.tfinger.fingerId;
388 } 388 }
389 finger[i].p.x = event.tfinger.x; 389 finger[i].p.x = event.tfinger.x;
390 finger[i].p.y = event.tfinger.y; 390 finger[i].p.y = event.tfinger.y;
391 break; 391 break;
392 case SDL_FINGERUP: 392 case SDL_FINGERUP:
393 printf("Figner: %i up - x: %i, y: %i\n",event.tfinger.fingerId, 393 printf("Figner: %li up - x: %f, y: %f\n",event.tfinger.fingerId,
394 event.tfinger.x,event.tfinger.y); 394 event.tfinger.x,event.tfinger.y);
395 for(i = 0;i<MAXFINGERS;i++) 395 for(i = 0;i<MAXFINGERS;i++)
396 if(index2fingerid[i] == event.tfinger.fingerId) { 396 if(index2fingerid[i] == event.tfinger.fingerId) {
397 index2fingerid[i] = -1; 397 index2fingerid[i] = -1;
398 break; 398 break;