Initial commit
This commit is contained in:
commit
edfc5298e1
252 changed files with 93965 additions and 0 deletions
96
source/Platform/Win32/Win32Application.cpp
Normal file
96
source/Platform/Win32/Win32Application.cpp
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include "Win32Keyboard.h"
|
||||
#include "Win32Mouse.h"
|
||||
#include "Win32Application.h"
|
||||
|
||||
void Win32Application::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Win32Application::shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
PlatformDisplay& Win32Application::getDisplay()
|
||||
{
|
||||
return m_display;
|
||||
} */
|
||||
|
||||
PlatformInput& Win32Application::getInput()
|
||||
{
|
||||
return m_input;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue