| | |
Accepting Characters Without Waiting
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
I am creating a game, without using any game related libraries, only the "standard" (read aside) ones and an edited conio.h. So I get to use getch(), kbhit() et al. My problem is with kbhit(), is there no way of resetting it, so that I can reuse it?
Aside : I understand that this is related to game development, I felt its not directly related.
I am a student and I was given the freedom to chose my own program to do as a project. The restrictions though was that I should use "standard" libraries only (they use Borland compilers and call it "standard"
).
Attached : A working version of the game. Unfortunately, I have reached a stage where I have moved forward and cannot compile the program and I have the older executable, so the EXE.
Aside : I understand that this is related to game development, I felt its not directly related.
I am a student and I was given the freedom to chose my own program to do as a project. The restrictions though was that I should use "standard" libraries only (they use Borland compilers and call it "standard"
).Attached : A working version of the game. Unfortunately, I have reached a stage where I have moved forward and cannot compile the program and I have the older executable, so the EXE.
Last edited by DigitalPackrat; Apr 29th, 2008 at 10:53 am.
>>My problem is with kbhit(), is there no way of resetting it, so that I can reuse it?
Yes, extract the character from the keyboard
>>The restrictions though was that I should use "standard" libraries only
There is NOTHING in conio.h that is standard C or C++. And there is no standard way to get one character from the keyboard without <Enter> key too.
Yes, extract the character from the keyboard
C++ Syntax (Toggle Plain Text)
if( kbdhit() ) getche(); // or some other function that extracts the key
>>The restrictions though was that I should use "standard" libraries only
There is NOTHING in conio.h that is standard C or C++. And there is no standard way to get one character from the keyboard without <Enter> key too.
Last edited by Ancient Dragon; Apr 29th, 2008 at 11:03 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Two straight replies that helped. Thanks Ancient Dragon. Though, I am waiting for a reply on this.
>>There is NOTHING in conio.h that is standard C or C++. And there is no standard way to get one character from the keyboard without <Enter> key too.
I understand that conio.h is not a part of standard library, what I was trying to say there is that I am not using the one provided by Borland.
>>There is NOTHING in conio.h that is standard C or C++. And there is no standard way to get one character from the keyboard without <Enter> key too.
I understand that conio.h is not a part of standard library, what I was trying to say there is that I am not using the one provided by Borland.
Last edited by DigitalPackrat; Apr 29th, 2008 at 11:09 am. Reason: Forgot to thank :)
![]() |
Other Threads in the C++ Forum
- Previous Thread: String Input - Not Happening Second Time
- Next Thread: What will happen if caught exception when new a object
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file format forms fstream function functions game generator givemetehcodez graph gui homeworkhelp iamthwee ifstream image input int java lib library list loop looping loops map math matrix memory multiple newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






