Running a function with two keys pressed at the same time.

I’m creating a two player pong game in OpenGL. Both players will control their paddle with the keyboard.

My question is: "Is there a way to create a function to receive two simul key presses at the same time and use them in one function? Or will both players have to resort to rapidly pressing their buttons?

Are you using any portability libraries (GLUT for example)?

I use VB and use the form_keypress to fire functions. I use it to rotate my drawings. I can press rotate y and rotate x and they both fire. The most I have been able to press at one time is four and sometimes three depending on the load on the computer.

the conventional method uses an array of boolean values to represent the keys. these serve as flags as to whether a certain key is pressed or not. you set the flag when the key is pressed, and clear it when the key is released.

jebus

nehe uses this method in many of his tutorials

Originally posted by jebus:
[b]the conventional method uses an array of boolean values to represent the keys. these serve as flags as to whether a certain key is pressed or not. you set the flag when the key is pressed, and clear it when the key is released.

jebus[/b]