| | |
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 array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






