![]() |
|
#1
|
||||
|
||||
keyboard events in turbo c++k i was trying to make a lil game in c++, everything seemed alright 'til i realized one major thing was missing : the keyboard input (omg). obviously the getch() and cin >> functions won't do i need a function that will return if a key is pressed and what it is. or sumthing like that. anyway i need something that will return the curent active key without pausing the game like getch() do. that's it, i need a getch() that won't pause the app...
is there anything in the basic header files of borland turbo c++ 3.idunno that could solve my prob? or if you could give me one with the function i need in it i would appreciate it as well. ... btw, nice forum! |
|
#2
|
||||
|
||||
|
Spelling the word "something" with an 'o' instead of with a 'u' may not help you solve your input problem, but at least I'd be thinking about your situation instead of commenting on your massacre of the word "something."
__________________
-Aaron |
|
#3
|
|||
|
|||
|
kbhit() returns true if a key gets hit. i think it's in conio.h
__________________
spasms!!! |
|
#4
|
||||
|
||||
|
Quote:
Code:
This will force the programme into a continous loop until a key is encountered..modify it as per your own programme..it doesn't need to be a loop, you can have if(kbhit()) { switch(..... which will check, every time it encounters the if statement.. |
|
#5
|
||||
|
||||
|
\o/ hey thanks guys, i've been searching it for months now!
... i didnt know twas in conio... silly me. |
|
#6
|
||||
|
||||
|
erm... just one last thing about the input thingy...
i want my game to have like a fps rate so i use the "delay" function to reduce the speed of my app.. it works just fine when i don't hold a key down, but if i do, it starts beep-ing and the program freezes. it's not very convenient when we play a platform game. if i don't put that delay function in my prog., it wont beep and everything will be a-ok... but it won't run at the same speed on others pcs... what can i do about it? |
|
#7
|
||||
|
||||
|
Hmm... I am not sure what reducing the speed of your app accomplishes... but generally, you'd want it to run at its optimal speed. Can't you ask the video card what the fps rate is? I don't know anything about graphics programming yet. You should teach me
__________________
-Aaron |
|
#8
|
||||
|
||||
|
Quote:
CPP / C++ / C Code:
__________________
Age is unimportant -- except in cheese |
|
#9
|
||||
|
||||
CPP / C++ / C Code:
well i guess my problem is solved |
Recent GIDBlog
Toyota - 2008 September Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Win32 API Keyboard events | JBowe | MS Visual C++ / MFC Forum | 4 | 04-Mar-2004 11:03 |
| list of the most common keyboard and mouse shortcuts for IE, Opera and Firebird | jrobbio | Computer Software Forum - Windows | 2 | 04-Sep-2003 09:10 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The