I’m currently coding a 3D engine in C and using GLUT to maintain maximum portability.
How do you allow for simultaneous key presses? For example, when I’m moving forward and then I want to strafe, I need to press the ‘forward’ button, let go, then press ‘strafe’ button. is there a way to handle button presses better without having to let go?
also, is there a platform-independent way to detect if you have RELEASED a key button? this would be very helpful to trigger deceleration in a 3D engine so your player doesn’t just stop instantaneously.
Q1: I’ve never had any problems with simultaneous keypresses in GLUT. Just associate a flag with each control key, set it to true in glutKeyboardFunc and to false in glutKeyboardUpFunc(). Then base your movement on the combination of the various key flags.