1
0
Fork 0

source/Platform/PlatformApplication.h: remove update(). platform event queue is handled in MessageQueue class.

This commit is contained in:
Henrik Hautakoski 2020-01-24 15:39:30 +01:00
parent 801ab1033f
commit f526b598e2
No known key found for this signature in database
GPG key ID: 96765B12FEAC4745
3 changed files with 0 additions and 78 deletions

View file

@ -20,8 +20,6 @@ public :
virtual PlatformInput& getInput() = 0;
virtual MessageQueue& getMessageQueue() = 0;
virtual void update() = 0;
};
} // namespace sp

View file

@ -1,7 +1,4 @@
#include <windows.h>
#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

View file

@ -24,12 +24,6 @@ public :
virtual MessageQueue& getMessageQueue();
virtual void update();
protected :
LRESULT processMessage(MSG msg);
protected :
//Win32Display m_display;