Hi, so I have a function that handles key presses in a game I'm working on in OpenGL. But, the thing is that even though I have made two squares and they both move when the correct key is pressed only one square is moved. Is there a way I can make the two squares move. This is the glutKeyboardFunc function I implimented:
void handleKeypress(unsigned char key, int x, int y)
{
switch (key) {
case 27:
exit(0);
break;
case 'w':
glutTimerFunc(0.001, moveSquareUp, 0);
break;
case 'd':
glutTimerFunc(0.001, moveSquareRight, 0);
break;
case 's':
glutTimerFunc(0.001, moveSquareDown, 0);
break;
case 'a':
glutTimerFunc(0.001, moveSquareLeft, 0);
break;
}
}
If you need any more code just ask.