Results 1 to 2 of 2

Thread: Keyboard Input

  1. #1
    Guest

    Keyboard Input

    Hello,
    I'v started learning OpenGL and am a bit stuck! I'v got a polygon to rotate around its centre but wish to be able to control it through the keyboard. I'v managed this and it changes direction when I press the LEFT/RIGHT keys Once!!! I want my polygon to move only when I hold down the keys, not when I just press once.

    Is this something to do with
    keyPressed()
    keyTyped()
    or
    key released?

    I'v put my method in keyPressed

    Does anyone have any ideas? Thanks very much, this is really confusing me

    btw I'm using C++.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jun 2002
    Location
    Philadelphia, PA, US
    Posts
    108

    Re: Keyboard Input

    stuff like keyboard input isn't standardized in c++. what you need to do depends on what windowing framework you're using. if you're using win32, look up the GetKeyState() function. or better yet, consider handling the WM_*BUTTON* messages. if you're using glut, take a look at glutKeyboardFunc() .

    -steve

    EDIT: ubb code is really stupid.

    [This message has been edited by SThomas (edited 04-26-2003).]

Similar Threads

  1. Keyboard input
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-25-2003, 11:00 PM
  2. VB - Keyboard Input
    By Bhaji123Go in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 11-08-2002, 02:34 PM
  3. Using Keyboard input?
    By GarlicGL in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-07-2001, 08:19 AM
  4. keyboard input
    By Vlasko in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-21-2001, 05:34 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