mince
asked on
Keyboard handler (for game) with Delphi or C++ Builder
How to make a keyboard handler (usually games use it, like
doom, duke nukeem so it can run very fast) with Delphi or C++ Builder. I want to get very immediate respons when I press keyboard so I can move fastly.
doom, duke nukeem so it can run very fast) with Delphi or C++ Builder. I want to get very immediate respons when I press keyboard so I can move fastly.
Hi,
Isn't "OnKeyDown"/"OnKeyUp" fast enough?
/// John
Isn't "OnKeyDown"/"OnKeyUp" fast enough?
/// John
If your program should recieve (and maybe process) the keyboard message first, try a hook function (see: SetWindowsHookEx). This will gain some extra microseconds.
And of course there is DirectX 5 - DirectInput as described in Mircosoft Press's 'Inside Direct X'. But I have never tried it myself...
Generally I would recommend using 'OnKeyDown'/'OnKeyUp' as the savest and easiest solution.
. and set the repetition rate in the control panel/keyboard to maximum.
Roadrunner
And of course there is DirectX 5 - DirectInput as described in Mircosoft Press's 'Inside Direct X'. But I have never tried it myself...
Generally I would recommend using 'OnKeyDown'/'OnKeyUp' as the savest and easiest solution.
. and set the repetition rate in the control panel/keyboard to maximum.
Roadrunner
Yup, as the guys told you what you should do I guess I don't need to repeat that suggestion again.... OnKeyPress/OnKeyDown/OnKey Up/SetWind owsHookEx/ UnhookWind ows.....an d so on.....
P.S. Especially for games I guess the Hook is better, but it's more comlex to implement.... By complex I mean that you need more, code, more though, and a DLL which should be provided with your program...
Regards,
Viktor Ivanov
P.S. Especially for games I guess the Hook is better, but it's more comlex to implement.... By complex I mean that you need more, code, more though, and a DLL which should be provided with your program...
Regards,
Viktor Ivanov
though = thought, actually it's though too ;->
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
study.