PDA

View Full Version : Multiple Keyboard presses?



02-12-2001, 05:25 AM
In nehe's tuts they describe a way to check if more than one key is pressed at once.
How do i make this in linux?
If i press up and left at the same time it will just go left.. =(

/Emil "Eaglez" Forsmark www.neuxsoftware.com (http://www.neuxsoftware.com)

rts
02-12-2001, 11:51 AM
I use the SDL library for nice input stuff (joysticks, mice, keyboard). Maybe it will help you too: www.libsdl.org (http://www.libsdl.org)



Originally posted by Eaglez:
In nehe's tuts they describe a way to check if more than one key is pressed at once.
How do i make this in linux?
If i press up and left at the same time it will just go left.. =(

/Emil "Eaglez" Forsmark www.neuxsoftware.com (http://www.neuxsoftware.com)

02-13-2001, 02:25 AM
Thanx for the answer.
Can you mail me some examples? plz =)


/Emil Forsmark

rts
02-13-2001, 09:53 AM
Try:

http://www.libsdl.org/docs/events/examples.html http://www.libsdl.org/demos.html http://www.libsdl.org/games_db/games.php3 http://www.libsdl.org/apps.html


Originally posted by Eaglez:
Thanx for the answer.
Can you mail me some examples? plz =)


/Emil Forsmark





[This message has been edited by rts (edited 02-13-2001).]

02-22-2001, 07:00 AM
One way to perform it, it's to used the glut key up function. You just have a global variable for each key you want to press. If the event key down is activated, change the state of the variable to press and perform the action into a idle function. When you detect the key is up, re-change the state to un-activated.

Hope it's help.
Vince


Originally posted by Eaglez:
In nehe's tuts they describe a way to check if more than one key is pressed at once.
How do i make this in linux?
If i press up and left at the same time it will just go left.. =(

/Emil "Eaglez" Forsmark www.neuxsoftware.com (http://www.neuxsoftware.com)

tfpsly
02-26-2001, 08:17 AM
GL has its own keyboard function, one called when a key is pushed, one called when a key is released (Same name with "Up" in addition).

Just keep in memory if your left/right/... keys are is pushed staight or not.