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;
|
destHeight = height;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
while (TRUE)
|
bool quitMessageReceived = false;
|
||||||
|
while (!quitMessageReceived)
|
||||||
{
|
{
|
||||||
auto tStart = std::chrono::high_resolution_clock::now();
|
auto tStart = std::chrono::high_resolution_clock::now();
|
||||||
if (viewUpdated)
|
if (viewUpdated)
|
||||||
|
|
@ -229,11 +230,12 @@ void VulkanExampleBase::renderLoop()
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.message == WM_QUIT)
|
if (msg.message == WM_QUIT)
|
||||||
{
|
{
|
||||||
break;
|
quitMessageReceived = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render();
|
render();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue