|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] The keys have benn captured!!!!
If you want the character echoed to the screen, you should use getche(). It works just like getch(), but automatically echoes to the screen. -----Original Message----- From: gameprogrammer-owner@gameprogrammer.com [mailto:gameprogrammer-owner@gameprogrammer.com]On Behalf Of Acidnaught Sent: 6. september 1999 17:25 To: gameprogrammer@gameprogrammer.com Cc: nikhilwiz@yahoo.com Subject: The keys have benn captured!!!! OK, listen to me everybody. I said I WILL implement OpenGl but I didn't say I was already implementing it. Yes, I am programing some DOS code for my university and finally I have the code right now, thanks to some of you and some other good stuff I found on the net. Some interesting aspects: getchar() doesn't work fine but getch() does. However it's very dificult to print on the screen the values this function retunrs, so I had to search for the right codes for this keys on the keyboard and I'd like to share them with all of you: here is the code: char c: if ((c = getch()) == 27) // Escape key was pressed so do whatever you want if (c == 72) // up arrow key was pressed so do whatever you want if (c == 80) // down arrow key was pressed so do whatever you want if (c == 77) // right arrow key was pressed so do whatever you want if (c == 75) // left arrow key was pressed so do whatever you want if (c == 13) // ENTER key was pressed so do whatever you want Hope somebody find this usefull (besides of me) -----Original Message----- From: Riccardo Fischetti <riccardo.fischetti@tiscalinet.it> To: gameprogrammer@gameprogrammer.com <gameprogrammer@gameprogrammer.com> Date: Monday, September 06, 1999 2:29 AM Subject: R: How to captue enter, up, down, left, right and Fx >Yeas, sure.....the getchar() function get char value without enter the >return key....but it display it on the screen.....:) >so, use getch() instead of getchar(), because it don't print the char on the >screen.... > >----- Original Message ----- >From: Eudoxus3 <Eudoxus@freeuk.com> >To: Game programmer <gameprogrammer@gameprogrammer.com> >Sent: Sunday, September 05, 1999 12:45 PM >Subject: Re: How to captue enter, up, down, left, right and Fx > > >> On Sun 05 Sep, justin howard wrote: >> > The number ten being returned is the ASCII code for it I believe. >> > Check an ascii table. >> > I think ENTER is equivalent to 0x10 or &H10 or Hexadecial 10 in >otherwords. >> > Hope that helps >> > >From: "AcidNaught" <luisfertv@geocities.com> >> > >Subject: How to captue enter, up, down, left, right and Fx >> > > clrscr(); >> > > flushall(); >> > > c = getchar(); >> >> Yes, the `getchar()` function returns the value of the character entered. >> Some functions are annoying (like scanf()`) because they only give a value >> once return has been pressed. >> >> The arrow keys won't give a value via `getchar()` because they don't have >> any ASCII values associated with them. >> >> Btw: ASCII stands for American Standard Character Information Interchange. >> Just thought u might like 2 no. >> >> >> Regards, >> >> Matt. W. >> -- >> *** eudoxus@freeuk.com *** http://members.xoom.com/eudoxusM/ >> mwebster@apsoft.co.uk >> >> ================================================================= >> To SUBSCRIBE or UNSUBSCRIBE please visit >> http://gameprogrammer.com/mailinglist.html >> >> > >================================================================= >To SUBSCRIBE or UNSUBSCRIBE please visit >http://gameprogrammer.com/mailinglist.html ================================================================= To SUBSCRIBE or UNSUBSCRIBE please visit http://gameprogrammer.com/mailinglist.html ================================================================= To SUBSCRIBE or UNSUBSCRIBE please visit http://gameprogrammer.com/mailinglist.html
|
|