http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



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

Re: The keys have benn captured!!!!



I am currently programming in DOS too. Planning to move to windows, but need to
crawl before I walk (haha).
Anyway, when capturing keycodes I actuall use a structure

struct keyBoard{
   int keyState;
   int keyVal; };

then i use a function with it

keyBoard getKey()
{  keyBoard k;
    k.keyState = FALSE;
    int c = getch();
    if(!c)    // if c==0 - extended key press
    { k.ketState = TRUE;
       k.keyVal = getch();
       return k; }
    else k.keyVal = c;
    return k; }

then when writing code use a keyBoard object and test for keyBoard key.State

Tkeys.h