Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / General Programming / need help with keyboard input Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Jens Wallman

August 25, 1999, 07:48 AM

Hi!

I'm currently experementing a bit with 3D-graphics using glide.The 3D stuff works fine.
But I need to know a good way of using the keyboard as a controller in the small 3D world I've created. Currently I'm using getch() (in C++ of course) but it's way to slow. Is there any other good way to check what keys are being pressed?
I'm using Borland Builder 3.0 when programming.

Jens

 
Jan Niestadt

August 25, 1999, 12:44 PM

>>But I need to know a good way of using the keyboard as a controller in the small 3D world I've created. Currently I'm using getch() (in C++ of course) but it's way to slow. Is there any other good way to check what keys are being pressed?

Is this a windows program or a DOS program?
If it's windows, process the WM_KEYDOWN / WM_KEYUP messages in your window handler (or OnKeyDown / OnKeyUp if you use MFC); or use DirectInput (not really necessary for keyboard input I think)
If it's DOS, you have to write your own keyboard interrupt handler. If you're interested, I think I've got one lying around..

 
Jens Wallman

August 25, 1999, 12:59 PM



Jan Niestadt wrote:
>>>>But I need to know a good way of using the keyboard as a controller in the small 3D world I've created. Currently I'm using getch() (in C++ of course) but it's way to slow. Is there any other good way to check what keys are being pressed?
>>
>>Is this a windows program or a DOS program?
>>If it's windows, process the WM_KEYDOWN / WM_KEYUP messages in your window handler (or OnKeyDown / OnKeyUp if you use MFC); or use DirectInput (not really necessary for keyboard input I think)
>>If it's DOS, you have to write your own keyboard interrupt handler. If you're interested, I think I've got one lying around..

Thanks!
I'll try that out. It's a windows program so i don't need your interrupt handler but thanks anyway.

 
Tchi

September 15, 1999, 06:26 AM

Well, using VK_KEYUP / VK_KEYDOWN messages to manage keyboard is quite fast, but the faster way is to use directinput !
It is not that hard to implement, you just need to initialize it, once done it's very easy to use...
I think you should take a look, even if you hate DirectX :=)

 
Johan

September 20, 1999, 03:26 AM



Tchi wrote:
>>Well, using VK_KEYUP / VK_KEYDOWN messages to manage keyboard is quite fast, but the faster way is to use directinput !
>>It is not that hard to implement, you just need to initialize it, once done it's very easy to use...
>>I think you should take a look, even if you hate DirectX :=)

Since there's still people with no DI support installed, you can use the keyboard hook feature it's simple to implement,fast and does'nt need any extra software to be installed.

 
jens wallman

September 28, 1999, 05:09 AM



Tchi wrote:
>>Well, using VK_KEYUP / VK_KEYDOWN messages to manage keyboard is quite fast, but the faster way is to use directinput !
>>It is not that hard to implement, you just need to initialize it, once done it's very easy to use...
>>I think you should take a look, even if you hate DirectX :=)

Thats exactly what I've done and it works perfect! Thanks for the tip anyway

 
This thread contains 6 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.