Windows message loop fixes, added mouse wheel zoom
This commit is contained in:
parent
e13f7c6e12
commit
af6df4e860
1 changed files with 17 additions and 8 deletions
|
|
@ -300,7 +300,8 @@ void VulkanExampleBase::renderLoop()
|
|||
while (TRUE)
|
||||
{
|
||||
auto tStart = std::chrono::high_resolution_clock::now();
|
||||
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
|
||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
if (msg.message == WM_QUIT)
|
||||
{
|
||||
break;
|
||||
|
|
@ -310,6 +311,7 @@ void VulkanExampleBase::renderLoop()
|
|||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
render();
|
||||
frameCounter++;
|
||||
auto tEnd = std::chrono::high_resolution_clock::now();
|
||||
|
|
@ -807,6 +809,13 @@ void VulkanExampleBase::handleMessages(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
|
|||
mousePos.x = (float)LOWORD(lParam);
|
||||
mousePos.y = (float)HIWORD(lParam);
|
||||
break;
|
||||
case WM_MOUSEWHEEL:
|
||||
{
|
||||
short wheelDelta = GET_WHEEL_DELTA_WPARAM(wParam);
|
||||
zoom += (float)wheelDelta * 0.005f * zoomSpeed;
|
||||
viewChanged();
|
||||
break;
|
||||
}
|
||||
case WM_MOUSEMOVE:
|
||||
if (wParam & MK_RBUTTON)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue