From f526b598e257b15ed8777513da089888535ea2df Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 24 Jan 2020 15:39:30 +0100 Subject: [PATCH] source/Platform/PlatformApplication.h: remove update(). platform event queue is handled in MessageQueue class. --- source/Platform/PlatformApplication.h | 2 - source/Platform/Win32/Win32Application.cpp | 70 ---------------------- source/Platform/Win32/Win32Application.h | 6 -- 3 files changed, 78 deletions(-) diff --git a/source/Platform/PlatformApplication.h b/source/Platform/PlatformApplication.h index 21315e8..800bf31 100644 --- a/source/Platform/PlatformApplication.h +++ b/source/Platform/PlatformApplication.h @@ -20,8 +20,6 @@ public : virtual PlatformInput& getInput() = 0; virtual MessageQueue& getMessageQueue() = 0; - - virtual void update() = 0; }; } // namespace sp diff --git a/source/Platform/Win32/Win32Application.cpp b/source/Platform/Win32/Win32Application.cpp index 20124e5..b125c7f 100644 --- a/source/Platform/Win32/Win32Application.cpp +++ b/source/Platform/Win32/Win32Application.cpp @@ -1,7 +1,4 @@ -#include -#include "Win32Keyboard.h" -#include "Win32Mouse.h" #include "Win32Application.h" namespace sp { @@ -30,71 +27,4 @@ MessageQueue& Win32Application::getMessageQueue() return m_messageQueue; } -void Win32Application::update() -{ - MSG msg; - - while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { - TranslateMessage(&msg); - processMessage(msg); - } -} - -LRESULT Win32Application::processMessage(MSG msg) -{ - switch(msg.message) { - case WM_QUIT : - m_messageQueue.postEvent(SysEvent(SysEvent::Quit)); - return 0; - // Input, Forward to devices. - case WM_KEYDOWN : - case WM_KEYUP : - OutputDebugString("WM_KEYDOWN\n"); - //SetCapture(msg.hwnd); - - if (Win32Keyboard::handleMessage(msg)) { - // Keyboard did handle the message. - return 0; - } - break; - case WM_MOUSEMOVE : - case WM_MOUSELEAVE : - - if (Win32Mouse::handleMessage(msg)) { - // Mouse did handle the message. - return 0; - } - break; - case WM_LBUTTONDOWN : - case WM_RBUTTONDOWN : - case WM_MBUTTONDOWN : - case WM_XBUTTONDOWN : - - SetCapture(msg.hwnd); - - if (Win32Mouse::handleMessage(msg)) { - // Mouse did handle the message. - return 0; - } - break; - case WM_LBUTTONUP : - case WM_RBUTTONUP : - case WM_MBUTTONUP : - case WM_XBUTTONUP : - - ReleaseCapture(); - - if (Win32Mouse::handleMessage(msg)) { - // Mouse did handle the message. - return 0; - } - break; - default : - break; - } - - // Message was not intercepted. Pass down to window. - return DispatchMessage(&msg); -} - } // namespace sp diff --git a/source/Platform/Win32/Win32Application.h b/source/Platform/Win32/Win32Application.h index c1e02b8..51ed8ab 100644 --- a/source/Platform/Win32/Win32Application.h +++ b/source/Platform/Win32/Win32Application.h @@ -24,12 +24,6 @@ public : virtual MessageQueue& getMessageQueue(); - virtual void update(); - -protected : - - LRESULT processMessage(MSG msg); - protected : //Win32Display m_display;