Member Avatar for DigitalPackrat

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.

Recommended Answers

All 2 Replies

>>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

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.

Member Avatar for DigitalPackrat

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.