feat: 实现 Window 与 InputModule 消息集成

This commit is contained in:
2026-03-22 17:14:11 +08:00
parent cf9229fc21
commit fa2d2713d7
9 changed files with 256 additions and 24 deletions

View File

@@ -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;