Window message WM_SIZING sending incessantly when window resizing
I make small game and have some problem with low priority window messages,
that incessantly sending from system and block running game logic's code.
I create my message loop something like this:
bool Window::SystemRoutineAndCheckQuit() {
::MSG msg;
while( ::PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ) ) {
if( msg.message == WM_QUIT ) {
::UnregisterClass( registeredClassName, ::GetModuleHandle(
nullptr ) );
DLOG( lg ) << "Exit from system loop" << DLOG_END;
return false;
}
::TranslateMessage( &msg );
::DispatchMessage( &msg );
}
return true;
}
//....
while( window.SystemRoutineAndCheckQuit() ) {
// do all render and logic
}
I.e. before every frame I wanna process all messages from windows and
then, when queue will empty do all logic. I notice when window resizing I
get same message WM_SIZING again and again and queue never will empty when
mouse button still press (even when size of window don't change from
previos call I receive message with same window coordinates). So it block
execute my code.
Is there any other messages, that keep windows message queue don't empty
and what is the best way to process all messages without some low
priority, like WM_SIZING?
Maybe just limit maximum count of processed messages from one check (it
can be bad?) or break when same message repeat two times in sequence
(right now I fix it that way, but maybe there are best solution )?
I test it on Windows 8.
PS: I need resize window, so I don't wanna disallow it by change style.
No comments:
Post a Comment