method5
03-26-2002, 04:50 PM
Currently I am using this for input..
void sinputevent(int key, int x, int y) {
objectype temp;
int move = 1;
switch (key) {
case GLUT_KEY_UP:
objects[0].y -= (pointscale * move);
break;
case GLUT_KEY_DOWN:
objects[0].y += (pointscale * move);
break;
case GLUT_KEY_LEFT:
objects[0].x -= (pointscale * move);
break;
case GLUT_KEY_RIGHT:
objects[0].x += (pointscale * move);
break;
}
glutPostRedisplay();
}
(note: I removed my routines to call collision detection to just show as an example here)
and it doesnt seem to let me push two keys at a time? any way around this?cause i need the guy to be able to walk diangly too (holding left and down for example)
[This message has been edited by method5 (edited 03-26-2002).]
void sinputevent(int key, int x, int y) {
objectype temp;
int move = 1;
switch (key) {
case GLUT_KEY_UP:
objects[0].y -= (pointscale * move);
break;
case GLUT_KEY_DOWN:
objects[0].y += (pointscale * move);
break;
case GLUT_KEY_LEFT:
objects[0].x -= (pointscale * move);
break;
case GLUT_KEY_RIGHT:
objects[0].x += (pointscale * move);
break;
}
glutPostRedisplay();
}
(note: I removed my routines to call collision detection to just show as an example here)
and it doesnt seem to let me push two keys at a time? any way around this?cause i need the guy to be able to walk diangly too (holding left and down for example)
[This message has been edited by method5 (edited 03-26-2002).]