Archived

This topic is now archived and is closed to further replies.

DrSmiley

Message Lag

Recommended Posts

DrSmiley    122
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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;
}

Share this post


Link to post
Share on other sites