Re: GetAsyncKeyState(vKey) & 0x8000
On Sun, 22 Apr 2007 19:02:44 +0200, "marco Rtype 6" <rebel-6-out@planet.nl>
wrote:
i thought i needed to rephrase my thread:
i'm writing a 3d engine.
like a regular FSP the 'look' direction is controlled by the mouse.
apart from that, i have a lot of key functions (getAsynckeystate),
and the WSAD keys control the movements.
my problem is:
when i keep a key depressed, like 'W' to move forward,
the mouse movement gets very shaky.
it looks like the key buffer is filling up and messing up the mouse,
or maybe WndProc(). and when i release the key,
it keeps shaking for a while.
i need fluent mouse movement combined with WSAD.
can anyone please help me out here?
DirectX is the standard for Windows gaming, so I would look to it for
advice on how to collect user input. To my surprise, when I looked up
DirectInput, the Wiki article I found said, "Microsoft recommends that new
applications make use of the windows message loop for keyboard and mouse
input instead of DirectInput as indicated in the Meltdown 2005 slideshow."
If so, Windows programs are intended to be event-driven, but it sounds like
you're busy looping around GetAsyncKeyState, which is sort of a cognitive
dissonance. Maybe you need to keep track of WM_KEYDOWN/WM_KEYUP transitions
as these messages are retrieved from your message loop. Again, I'd check
out the DirectX docs and groups for a definitive answer.
--
Doug Harrison
Visual C++ MVP