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: Problem with getch( )



============================================================
IT'S ABOUT TIME! If you are over age 50, claim the discounts
you deserve at SeniorDiscounts.com. You've earned it, so
take advantage--FREE access to over 40,000 discounts!
http://click.topica.com/caaacmtbUrGczbU68iFa/seniordiscounts
============================================================

>
>Hi,
>
>erm...you could try something like this:
>
>main()
>{
>   if(getch()!= /*put the keys to be tested for*/ || getch == NULL /*ie. no 
>key is pressed*/)
>   {
>      UpdateBackground();
>   }
>   else
>   {
>      RedrawShipAtNewLocation();
>      UpdateBackground();
>   }
>}
>
>This should work - i am not sure tho.
>
>Rob
That way should work. But that becomes one hell of an IF statement before 
too long.  The way I used to do it was:

int key;

key = getch();      // get the current key press(

switch(key)
{
         case 75:   // left arrow key
            DoSomeStuff();
            break;

...and so on and so forth.
This helps keep things organized and makes it easy to expand to check for 
new key presses.

Ryan


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

============================================================
How much can you save on your favorite stuff?
With TopOffers, the sweet deals & super savings never stop.
http://click.topica.com/caaacgNbUrGczbU68iFf/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
==^================================================================