Message Lag

Started by
1 comment, last by DrSmiley 20 years, 8 months ago
Hi everyone, I''m hoping someone out there will be able to shed some light on what i''ve been tearing my hair out over for the last few days. I''m writing an opengl win32 app, and the problem occurs when holding down a single key (i.e. to move the camera forward), and moving the mouse at the same time. Upon releasing the key, the app still deems it to be depressed, for a duration based upon how much the mouse was moved. Pressing another key while still holding down the original key and moving the mouse seems to cancel this effect... When a key is pressed, all I do is set a bool in a key[] to true, and then to false as it is released through the WM_KEYDOWN and WM_KEYUP callbacks in the WndProc function. I don''t handle any callbacks from the mouse as such. Camera motion is handled at the start of a repaint where the motion is calculated based upon the mouse cursor''s location from the centre of the view, before being SetCursorPos back into the middle. Am i being a complete idiot and/or setting up my window wrong? Any ideas would be greatly appreciated.
Advertisement
The Win32 messaging system is very slow. Try using DirectInput if you are just working with Windows.
____________________________________________________________AAAAA: American Association Against Adobe AcrobatYou know you hate PDFs...
I''m not sure if this is completely legal but you could set the keys to false yourself like...

if(keys[VK_UP])
{
//...do some stuff
keys[VK_UP]=false;
}

This topic is closed to new replies.

Advertisement