According to MSDN PeekMessage returns false only when the message queue is empty. If there is another message after WM_QUIT, the part of the code responsible for proper closing of the application would never be triggered. This change handles WM_QUIT message properly.
This commit is contained in:
parent
13d6076a5f
commit
0cef15c0f2
1 changed files with 7 additions and 5 deletions
|
|
@ -216,7 +216,8 @@ void VulkanExampleBase::renderLoop()
|
|||
destHeight = height;
|
||||
#if defined(_WIN32)
|
||||
MSG msg;
|
||||
while (TRUE)
|
||||
bool quitMessageReceived = false;
|
||||
while (!quitMessageReceived)
|
||||
{
|
||||
auto tStart = std::chrono::high_resolution_clock::now();
|
||||
if (viewUpdated)
|
||||
|
|
@ -229,11 +230,12 @@ void VulkanExampleBase::renderLoop()
|
|||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
break;
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
quitMessageReceived = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
render();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue