projects
/
freeglut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed shader route in shapes demo:
[freeglut]
/
progs
/
demos
/
multi-touch
/
multi-touch.c
diff --git
a/progs/demos/multi-touch/multi-touch.c
b/progs/demos/multi-touch/multi-touch.c
index
42842de
..
f294a1b
100644
(file)
--- a/
progs/demos/multi-touch/multi-touch.c
+++ b/
progs/demos/multi-touch/multi-touch.c
@@
-41,20
+41,21
@@
typedef struct cursor {
} *Cursor;
struct cursor cursors[NUM_DEVICES][NUM_CURSORS];
} *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,
};
-.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);
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 (d = 0; d < NUM_DEVICES; d++) {
int c;
for (c = 0; d < NUM_DEVICES; d++) {
@@
-94,15
+95,15
@@
void onDisplay() {
void onMouse(int button, int state, int x, int y) {
if (button == 0) {
cursors[0][0].on = (state == GLUT_DOWN);
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) {
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;
}
/* Using FG2.8 (reversed) prototype for now */
}
/* Using FG2.8 (reversed) prototype for now */
@@
-114,8
+115,8
@@
void onMultiButton(int cursor_id, int x, int y, int button, int state) {
}
if (button == 0) {
cursors[0][cursor_id].on = (state == GLUT_DOWN);
}
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);
}
}
printf("multi-touch %d click\n", cursor_id);
}
}
@@
-125,8
+126,8
@@
void onMultiMotion(int cursor_id, int x, int y) {
fprintf(stderr, "cursor_id(%d) > NUM_CURSORS(%d)\n", cursor_id, NUM_CURSORS);
return;
}
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) {
}
void onReshape(int width, int height) {
@@
-136,7
+137,7
@@
void onReshape(int width, int height) {
glOrtho(0, width, height, 0, -1, 1);
}
glOrtho(0, width, height, 0, -1, 1);
}
-void onIdle() {
+void onIdle(void) {
glutPostRedisplay();
}
glutPostRedisplay();
}