Files
XCEngine/engine/include/XCEngine/Platform/Windows/WindowsWindow.h
ssdfasd 36d3decef6 feat: 添加独立的输入系统和平台抽象层
- 新增 Platform 模块:PlatformTypes.h, Window.h, WindowsWindow
- 新增 Input 模块:InputTypes, InputEvent, InputAxis, InputModule, InputManager
- 新增 WindowsInputModule 处理 Win32 消息转换
- 将 RHI 集成测试从 render_model 迁移到 sphere
- 更新 CMakeLists.txt 添加 Platform 和 Input 模块
2026-03-22 15:21:52 +08:00

49 lines
1.4 KiB
C++

#pragma once
#include "Platform/Window.h"
#include <Windows.h>
#include <functional>
namespace XCEngine {
namespace Platform {
class WindowsWindow : public Window {
public:
WindowsWindow();
virtual ~WindowsWindow();
bool Create(const WindowDesc& desc) override;
void Destroy() override;
WindowHandle GetHandle() const override { return m_hwnd; }
void PumpEvents() override;
void SetTitle(const Containers::String& title) override;
void SetFullscreen(bool fullscreen) override;
bool IsFullscreen() const override { return m_fullscreen; }
void Minimize() override;
void Maximize() override;
void Restore() override;
bool ShouldClose() const override { return m_shouldClose; }
void* GetNativeHandle() override { return m_hwnd; }
void SetMessageCallback(std::function<void(HWND, UINT, WPARAM, LPARAM)> callback);
private:
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void RegisterWindowClass();
bool CreateMainWindow(const WindowDesc& desc);
HWND m_hwnd = nullptr;
HINSTANCE m_hInstance = nullptr;
bool m_fullscreen = false;
bool m_shouldClose = false;
bool m_minimized = false;
RECT m_oldWindowRect = {};
std::function<void(HWND, UINT, WPARAM, LPARAM)> m_messageCallback;
};
} // namespace Platform
} // namespace XCEngine