Multiple Keyboard presses?

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

I use the SDL library for nice input stuff (joysticks, mice, keyboard). Maybe it will help you too: www.libsdl.org

Originally posted by Eaglez:
[b]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 [/b]

Thanx for the answer.
Can you mail me some examples? plz =)

/Emil Forsmark

Try:

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

/Emil Forsmark

[/b]

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

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:
[b]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 [/b]

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.