2021-01-30 16:28:14 +00:00
|
|
|
#pragma once
|
|
|
|
#include "common/windows_headers.h"
|
|
|
|
#include "nogui_host_interface.h"
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class Win32HostInterface final : public NoGUIHostInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Win32HostInterface();
|
|
|
|
~Win32HostInterface();
|
|
|
|
|
|
|
|
bool Initialize();
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
static std::unique_ptr<NoGUIHostInterface> Create();
|
|
|
|
|
|
|
|
protected:
|
2021-10-27 10:03:55 +00:00
|
|
|
void SetMouseMode(bool relative, bool hide_cursor) override;
|
|
|
|
|
2021-05-21 03:10:23 +00:00
|
|
|
bool CreatePlatformWindow() override;
|
2021-01-30 16:28:14 +00:00
|
|
|
void DestroyPlatformWindow() override;
|
|
|
|
std::optional<WindowInfo> GetPlatformWindowInfo() override;
|
|
|
|
|
|
|
|
std::optional<HostKeyCode> GetHostKeyCode(const std::string_view key_code) const override;
|
|
|
|
|
|
|
|
void PollAndUpdate() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
|
|
|
|
|
|
|
bool RegisterWindowClass();
|
|
|
|
void ProcessWin32Events();
|
|
|
|
|
|
|
|
HWND m_hwnd{};
|
|
|
|
};
|