Allegro Specific key input...

This is a discussion on Allegro Specific key input... within the Game Programming forums, part of the General Programming Boards category; I am using the allegro provided key stuff. (key[KEY_DOWN] etc). How can I make it so it only detects a ...

  1. #1
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138

    Allegro Specific key input...

    I am using the allegro provided key stuff. (key[KEY_DOWN] etc). How can I make it so it only detects a keypressed WHILE it is being pressed. As is, if I press a key and let go, that key is still returned as positive! (though it isnt affecting the player moving around; it is an rpg I am making...) Any tips would be excelent, ty. I tried clear_keybuf(), with no luck. I also tried setting the keys to 0 after each time I used it, but that made it reaallly slow . Thank you, I am very stumped...

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Try adding this just before you check keys:
    Code:
    if( keyboard_needs_poll( ) ) poll_keyboard( );
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    nope, no luck . Ty for reply though

  4. #4
    Rambling Man
    Join Date
    Jan 2002
    Posts
    1,050

  5. #5
    Registered User
    Join Date
    Mar 2002
    Posts
    249
    Guess I'm not sure what your saying. key[KEY_WHATEVER] does detect only while the key is being pressed....
    Well, there are a few things wrong with your code:

    1) It does not work.
    2) It does not work.
    3) It does not work.

    Hope this helps.

  6. #6
    plzduntlakliekthiskthx
    Join Date
    Oct 2002
    Posts
    138
    Originally posted by funkydude9
    Guess I'm not sure what your saying. key[KEY_WHATEVER] does detect only while the key is being pressed....
    are you sure? not for me. I put clear_keybuf() in a different spot and it works now, but only for a little bit. If i keep moving my character around, after a while it stops working the way I want it... I will post some code tomorrow so maybe you can see what I am doing wrong :/.

  7. #7
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    When I used Allegro, the keys were only detected while they are down, and when they aren't, they weren't detected.

    Can you show me some of your code?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. I would love some input on my BST tree.
    By StevenGarcia in forum C++ Programming
    Replies: 4
    Last Post: 01-15-2007, 01:22 AM
  3. Trouble with a lab
    By michael- in forum C Programming
    Replies: 18
    Last Post: 12-06-2005, 11:28 PM
  4. how do you get arrow key input in DOS??
    By kwm32 in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-25-2004, 01:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21