More than 1 key held down

When I hold down a key to move around an object, it jerks for a bit then moves constantly. However, if I then press another key down it ceases all movement. I’m making a simple 2 player aracde game in GLUT and this is a major flaw, with there being two players :stuck_out_tongue:

Any help greatly appreciated.

goto and look at the basecode he uses. The lessons are in Win32 (though you can download glut source), but the idea of using an array of bools works quite well

Use GetAsyncKeyState (defined in winuser.h).
That’s not the only way, but the simplest in my opinion. You can also use GLUT to maintain an array of bools (1 per key) - this has been covered in some recent threads.

Hope this helps

GLFW does this automatically for you. The glfwGetKey() function checks the value of a key-code array, which maintains up-to-date key states. There is also an example of a simple two-player game included with the GLFW distribution that uses the keyboard for input.