still need help (reading keypresses simultaneously) - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

still need help (reading keypresses simultaneously)

I get the concept of making a table of keys pressed. I have gotten to the point now, that I can read all the keys that are pressed and set their value in the array to 1 indicating that they have been pressed. The only problem now is that I don't know how to see if the key is done being pressed or not. I need to know how to code a keyDown() function for this. (I am using Turbo C++ 3.0)



In case it helps any, I am making a modified clone of Asteroids with a two player mode. It is necessary that I can read both players' key commands. After all, what is the point of a space shooter if you have to take turns shooting each other? I have studied a few other people's code, but as I am pretty new to programming, I can't understand the code very well. If there is any way to put things more simply, please do so. Specifically, I have noticed a line that is quite similar in several programs. It looks similar to the following:



keys=(keyboard far *)MK_FP(0x40,0x17);



Thanks in advance for any help anyone can offer!






Comments

  • : I get the concept of making a table of keys pressed. I have gotten to the point now, that I can read all the keys that are pressed and set their value in the array to 1 indicating that they have been pressed. The only problem now is that I don't know how to see if the key is done being pressed or not. I need to know how to code a keyDown() function for this. (I am using Turbo C++ 3.0)



    Why are you using Turbo C++? That old compiler sucks and can't even address 32-bit memory.



    Get a better one like the free 32-bit C/C++ compiler DJGPP (www.delorie.com/djgpp/).



    And with DJGPP you can use the Allegro graphics library (http://www.talula.demon.co.uk/allegro/) which has graphics routines, a keyboard handler, sound handler, midi, etc.



    I'd suggest using that keyboard handler rather than making your own.



    -Xotor-


  • : Why are you using Turbo C++? That old compiler sucks and can't even address 32-bit memory.

    :

    : Get a better one like the free 32-bit C/C++ compiler DJGPP (www.delorie.com/djgpp/).

    :

    : And with DJGPP you can use the Allegro graphics library (http://www.talula.demon.co.uk/allegro/) which has graphics routines, a keyboard handler, sound handler, midi, etc.

    :

    : I'd suggest using that keyboard handler rather than making your own.

    :

    : -Xotor-





    Thanks for the reply. I'll take your advice. The reason I'm using Turbo C++ is because that's what we're learning with at school and I would like to familiarize myself with it so I can be more productive there. Thanks again.






Sign In or Register to comment.