Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Multiple Keyboard presses?

  1. #1
    Guest

    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

  2. #2
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    418

    Re: Multiple Keyboard presses?

    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:
    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

  3. #3
    Guest

    Re: Multiple Keyboard presses?

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


    /Emil Forsmark

  4. #4
    Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Vancouver BC Canada
    Posts
    418

    Re: Multiple Keyboard presses?

    Try:



    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).]

  5. #5
    Guest

    Re: Multiple Keyboard presses?

    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

  6. #6
    Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Montréal, QC, Canada
    Posts
    304

    Re: Multiple Keyboard presses?

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •