Results 1 to 4 of 4

Thread: keyboard input

  1. #1
    Senior Member Regular Contributor
    Join Date
    Mar 2003
    Location
    Slovakia
    Posts
    108

    keyboard input

    I'm using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right ....)

  2. #2
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: keyboard input

    Originally posted by vlasko:
    I'm using GLUT keyboard functions (glutSpecialFunc).How to make then to accept more than 1 key (I want to move object not only in up ,down ,left, right direction but also up-left, up-right ....)
    I am not a GLUT expert, but with GLFW (http://opengl.freehosting.net/glfw/), which is very similar to GLUT, you can use glfwGetKey() to check for several keys. E.g.:

    if( glfwGetKey( GLFW_KEY_UP ) )
    {
    ... move up ...
    }
    if( glfwGetKey( GLFW_KEY_DOWN ) ) {
    ... move down ...
    } etc.

    /Marcus

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jul 2001
    Posts
    352

    Re: keyboard input

    Don't use callback functions, use GetAsyncKeyState (see my reply in the GLUT&Input thread).

  4. #4
    Senior Member Frequent Contributor marcus256's Avatar
    Join Date
    Aug 2001
    Location
    Sweden
    Posts
    764

    Re: keyboard input

    How much better is GetAsyncKeyState? I've heard that you get better response times. Is there a point in using GetAsyncKeyState if I'm already using a callback function for polling other events?

Similar Threads

  1. Keyboard input
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-25-2003, 11:00 PM
  2. Keyboard Input
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-26-2003, 02:01 PM
  3. VB - Keyboard Input
    By Bhaji123Go in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-08-2002, 02:34 PM
  4. Using Keyboard input?
    By GarlicGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-07-2001, 08:19 AM
  5. get keyboard input
    By vgm2 in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 03-14-2001, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean