X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=progs%2Fdemos%2Fmulti-touch%2Fmulti-touch.c;h=e4fc596b1e818c1d049c1e3c94a326b77c6db2c8;hb=3cb75b2e5c19ab250a5dfd0ca7da0fe7355269ec;hp=ee5b2bb78bc9614e26725166cc68d855875acdde;hpb=22ad03e012b2525e5f5a87741271ebc37855b709;p=freeglut diff --git a/progs/demos/multi-touch/multi-touch.c b/progs/demos/multi-touch/multi-touch.c index ee5b2bb..e4fc596 100644 --- a/progs/demos/multi-touch/multi-touch.c +++ b/progs/demos/multi-touch/multi-touch.c @@ -41,23 +41,24 @@ typedef struct cursor { } *Cursor; struct cursor cursors[NUM_DEVICES][NUM_CURSORS]; -void onDisplay() { - glClearColor(0,0,0,1); - glClear(GL_COLOR_BUFFER_BIT); - float square[] = { +static float square[] = { -.5, -.5, .5, -.5, -.5, .5, .5, .5, }; +void onDisplay(void) { + int d; + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT); + glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, square); - int d; for (d = 0; d < NUM_DEVICES; d++) { int c; - for (c = 0; d < NUM_DEVICES; d++) { + for (c = 0; c < NUM_CURSORS; c++) { Cursor C = &cursors[d][c]; if (C->on) { glMatrixMode(GL_MODELVIEW); @@ -94,37 +95,39 @@ void onDisplay() { void onMouse(int button, int state, int x, int y) { if (button == 0) { cursors[0][0].on = (state == GLUT_DOWN); - cursors[0][0].x = x; - cursors[0][0].y = y; + cursors[0][0].x = (float)x; + cursors[0][0].y = (float)y; printf("normal click\n"); } } void onMotion(int x, int y) { - cursors[0][0].x = x; - cursors[0][0].y = y; + cursors[0][0].x = (float)x; + cursors[0][0].y = (float)y; } -void onMultiButton(int cursor_id, int button, int state, int x, int y) { +/* Using FG2.8 (reversed) prototype for now */ +/* void onMultiButton(int cursor_id, int button, int state, int x, int y) { */ +void onMultiButton(int cursor_id, int x, int y, int button, int state) { if (cursor_id > NUM_CURSORS) { - fprintf(stderr, "cursor_id(%d) > NUM_CURSORS(%d)\n", cursor_id, NUM_CURSORS); + fprintf(stderr, "cursor_id (%d) > NUM_CURSORS (%d)\n", cursor_id, NUM_CURSORS); return; } if (button == 0) { cursors[0][cursor_id].on = (state == GLUT_DOWN); - cursors[0][cursor_id].x = x; - cursors[0][cursor_id].y = y; + cursors[0][cursor_id].x = (float)x; + cursors[0][cursor_id].y = (float)y; printf("multi-touch %d click\n", cursor_id); } } void onMultiMotion(int cursor_id, int x, int y) { if (cursor_id > NUM_CURSORS) { - fprintf(stderr, "cursor_id(%d) > NUM_CURSORS(%d)\n", cursor_id, NUM_CURSORS); + fprintf(stderr, "cursor_id (%d) > NUM_CURSORS (%d)\n", cursor_id, NUM_CURSORS); return; } - cursors[0][cursor_id].x = x; - cursors[0][cursor_id].y = y; + cursors[0][cursor_id].x = (float)x; + cursors[0][cursor_id].y = (float)y; } void onReshape(int width, int height) { @@ -134,7 +137,7 @@ void onReshape(int width, int height) { glOrtho(0, width, height, 0, -1, 1); } -void onIdle() { +void onIdle(void) { glutPostRedisplay(); }