feat: 实现 Window 与 InputModule 消息集成
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "Platform/Windows/WindowsWindow.h"
|
||||
#include "Input/Platform/WindowsInputModule.h"
|
||||
#include <Windows.h>
|
||||
|
||||
namespace XCEngine {
|
||||
@@ -80,6 +81,10 @@ void WindowsWindow::PumpEvents() {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
if (m_inputModule) {
|
||||
m_inputModule->PumpEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void WindowsWindow::SetTitle(const Containers::String& title) {
|
||||
@@ -164,6 +169,15 @@ LRESULT CALLBACK WindowsWindow::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
|
||||
window->m_messageCallback(hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
if (window && window->m_inputModule) {
|
||||
window->m_inputModule->HandleMessage(
|
||||
reinterpret_cast<size_t>(hwnd),
|
||||
static_cast<unsigned int>(msg),
|
||||
static_cast<size_t>(wParam),
|
||||
static_cast<size_t>(lParam)
|
||||
);
|
||||
}
|
||||
|
||||
switch (msg) {
|
||||
case WM_CLOSE:
|
||||
if (window) window->m_shouldClose = true;
|
||||
|
||||
Reference in New Issue
Block a user