PDA

View Full Version : Running a function with two keys pressed at the same time.



Tazz FTAlliance
11-08-2002, 07:04 AM
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?

mm_freak
11-08-2002, 07:25 AM
Are you using any portability libraries (GLUT for example)?

John Jenkins
11-08-2002, 08:24 AM
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.

jebus
11-08-2002, 08:26 AM
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

jono_123
11-08-2002, 10:24 PM
nehe uses this method in many of his tutorials
nehe.gamedev.net


Originally posted by jebus:
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