Thread: keyboard

  1. #1
    kirby_thegreat
    Guest

    keyboard

    I've been having a problem with one of my programs where I want to move a cursor everytime a key is pressed. It looks like this.

    do{
    if (kbhit())
    MovePaddle();
    }while(1);

    The problem is that if you hold down a key it (kbhit) doesn't return true constantly, so the paddle just moves one little pixel at a time. I want to make it so that it moves everytime it loops around, and then I can control it with a time condition. Does anyone know of a unction that I can use to return true constantly while a key is pressed and ale only when it is released? kbhit just returns true as fast as the keyboards repeat rate.

  2. #2
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301
    i know how to do this using some windows.h functions, but i don't think that's what you want...

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    If you're using "true DOS" you can replace the current keyboard handler with your own using interupts. Check out this file:
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Detecting keyboard and mouse in linux
    By sameer.nalwade in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 04:24 AM
  2. Keyboard port using other that a keyboard
    By antoinelac in forum C++ Programming
    Replies: 4
    Last Post: 06-12-2008, 02:46 PM
  3. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  4. What type of keyboard is this?
    By 7smurfs in forum Tech Board
    Replies: 5
    Last Post: 06-22-2005, 05:09 PM
  5. Game Design Topic #2 - Keyboard or Mouse?
    By TechWins in forum Game Programming
    Replies: 4
    Last Post: 10-08-2002, 03:34 PM