http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

TheGrumpyProgrammer



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keydown in Windows Console?



Personally I do the following :

#define KeyPressed(key) (GetAsyncKeyState(key) & 0x8000)


if ( KeyPressed(VK_UP) || Keypressed(VK_LBUTTON) )
{
    MoveForeward();
}

etc.

Steve.
_____________________________________
Steve Eckles
Programmer,
Intech Ltd.
steve@intech.co.uk
http://tatooine.fortunecity.com/falcon/183/
_____________________________________

----- Original Message -----
From: "Brian Holley" <comp_brain@hotmail.com>
To: <gameprogrammer@gameprogrammer.com>
Sent: 21 May 2000 17:27
Subject: Re: Keydown in Windows Console?


> Hey-
>
> You can use a function that won't wait by doing something like this:
>
> file://This may need a little tweaking
> int KbHit()
> {
>      int key;
>      if (kbhit())
>           key = getch();  file://This will only getch() if one is
available
>      return key;
> }
>
> Hope this helps.
> -Brian
>
>
> >Hello GameProgrammer!
> >
> >First of all, thanx everyone who has helped me before... I can't believe
> >I
> >survived so long without a mailing list :-)
> >
> >Now for the problem, a quick one:
> >if you create a console app (in Borland C++ Builder 3), and use the
> >function GetAsyncKeyState(VK_CODE); will it work? It sure
> >doesn't seem to.
> >I have tried to get input with getch(); but then the program will wait
> >for input and I want it to be real-time! The help files for Borland is
> >somewhat obscure by my opinion...
> >
> >
> >Thankyou!
> >David
> >
> >=================================================================
> >The GameProgrammer.Com mailing list is for the open discussion
> >of any topic related to the art, science, and business of
> >programming games. This list is especially tolerant of beginners.
> >We were all beginners once
> >
> >To SUBSCRIBE or UNSUBSCRIBE please visit:
> >http://gameprogrammer.com/mailinglist.html
>
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
> =================================================================
> The GameProgrammer.Com mailing list is for the open discussion
> of any topic related to the art, science, and business of
> programming games. This list is especially tolerant of beginners.
> We were all beginners once
>
> To SUBSCRIBE or UNSUBSCRIBE please visit:
> http://gameprogrammer.com/mailinglist.html

=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once

To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html