Re: [GD-Windows] Input thread
Brought to you by:
vexxed72
From: Javier A. <ja...@py...> - 2003-06-06 11:40:42
|
Pierre Terdiman wrote: >> Windows messages can be lost if your window lose the focus. You >> should handle the WM_ACTIVATE message: if your window lose the focus >> you should stop every activity in your program (so in your example >> send a stop event to the character) > > Well, I already handle WM_SETFOCUS & WM_KILLFOCUS. That's pretty much > mandatory with GetAsyncKeyState ... If you use windows messages for mouse stuff, it's also a good idea to capture the mouse when you receive a mouse down. In a full screen app the mouse is always over the window, but if you support windowed mode (you do, right? Debugging), you could receive a BUTTONDOWN but not the corresponding BUTTONUP because the mouse has moved outside the window (the window is still in focus). Also remember that SetCapture() and ReleaseCapture() are not refcounted, so multiple simultaneous button presses need special care. Another more hackish option is, right after processing all pending windows messages, scan the input (mouse & keyboard) to update for any potentially lost or mishandled messages. Javier Arevalo Pyro Studios |