|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: Problem with getch( )
At 09:14 PM 6/19/01 -0700, you wrote:
>Any keyboard interrupt handler is basically direct access except that it's
>wrapped with more easily understood data structures and function calls.
>That would seem to be your best bet considering it's built in to TurboC and
>there's most likely a help file to show how to use it.
>
>Keyboard interrupts work quite differently from the standard buffered input
>of C/C++ (as well as most other programming languages). When a key is
>pressed, the interrupt handler receives a scan code from 0-128, (usually
>only up to 104), and when it's released, it receives the same value plus
>128. (the high order bit is set.) Each key has a different scancode
>(including alt, ctrl and the like). Key/Scancode tables are available all
>over the place
>
>The best way to deal with this is to set flags indicating which keys are
>pressed. then in your game loop, perform an action based on which flags are
>set. Here's some pseudo-code:
>
>interrupt handler(scanCode)
>{
> if Y is pressed, set YPressed to true
>}
>
>program code
>.
>.
>.
>if YPressed, perform action
>.
>.
>.
>
>Anyone else, feel free to make any objections or other comments...
Err, u hafta have a way of clearing the flags as well, and debouncing the
keystrokes. U may get 2 keystrokes while u process one.
grant
============================================================
Need to s-t-r-e-t-c-h your dollars?
Get more bang for your buck with cool savings, hot deals, &
free stuff.
http://click.topica.com/caaacgFbUrGczbU68iFf/TopOffers
============================================================
==^================================================================
EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrGcz.bU68iF
Or send an email To: gameprogrammer-unsubscribe@topica.com
This email was sent to: list@pendleton.com
T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================
|
|