Original Post
Hi, everybody, this is the first time i do the keyboard input part in OpenGL, now the program can run , the object also can move according the direction buttons, but when i want to do something like this, when i press UP and RIGHT button at the same time and without release them, the object keep moving towards the 45 degree direction, now when i press them, the object just move once towards the direction, so anyone can teach me how?? thanks a lot !! it is the problem in control codes or other part? this is the control part codes
void SpecialKeys(int key, int x, int y)
{
switch(key)
{
case GLUT_KEY_UP :
b += 5.5f; // b stands for y direction
break;
case GLUT_KEY_DOWN :
b -= 5.5f;
break;
case GLUT_KEY_LEFT :
a -= 5.5f; // a stands for x direction
break;
case GLUT_KEY_RIGHT :
a += 5.5f;
break;
}
}