Accepting Characters Without Waiting

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2008
Posts: 33
Reputation: DigitalPackrat is an unknown quantity at this point 
Solved Threads: 1
DigitalPackrat's Avatar
DigitalPackrat DigitalPackrat is offline Offline
Light Poster

Accepting Characters Without Waiting

 
0
  #1
Apr 29th, 2008
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.
Last edited by DigitalPackrat; Apr 29th, 2008 at 10:53 am.
Attached Files
File Type: zip The Tank and the #.zip (131.5 KB, 1 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,407
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1468
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: Accepting Characters Without Waiting

 
0
  #2
Apr 29th, 2008
>>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
  1. if( kbdhit() )
  2. 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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 33
Reputation: DigitalPackrat is an unknown quantity at this point 
Solved Threads: 1
DigitalPackrat's Avatar
DigitalPackrat DigitalPackrat is offline Offline
Light Poster

Re: Accepting Characters Without Waiting

 
0
  #3
Apr 29th, 2008
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.
Last edited by DigitalPackrat; Apr 29th, 2008 at 11:09 am. Reason: Forgot to thank :)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC