cae  0.0.0
Cross-API graphics engine
Loading...
Searching...
No Matches
Win32.hpp
Go to the documentation of this file.
1///
2/// @file Win32.hpp
3/// @brief This file contains the Win32 class declaration
4/// @namespace cae
5///
6
7#pragma once
8
9#ifdef _WIN32
10
12
13#include <windows.h>
14
15#include <queue>
16
17namespace cae
18{
19
20 ///
21 /// @class Win32
22 /// @brief Class for the Win32 plugin
23 /// @namespace cae
24 ///
25 class Win32 final : public AWindow
26 {
27
28 public:
29 Win32() = default;
30 ~Win32() override = default;
31
32 Win32(const Win32 &) = delete;
33 Win32 &operator=(const Win32 &) = delete;
34 Win32(Win32 &&) = delete;
35 Win32 &operator=(Win32 &&) = delete;
36
37 [[nodiscard]] std::string getName() const override { return "Win32"; }
38 [[nodiscard]] utl::PluginType getType() const override { return utl::PluginType::WINDOW; }
39 [[nodiscard]] utl::PluginPlatform getPlatform() const override { return utl::PluginPlatform::WINDOWS; }
40
41 bool create(const std::string &name, WindowSize size) override;
42 void close() override;
43
44 [[nodiscard]] NativeWindowHandle getNativeHandle() const override;
45 [[nodiscard]] WindowSize getWindowSize() const override;
46
47 void setIcon(const std::string &path) const override;
48
49 [[nodiscard]] bool shouldClose() const override { return m_shouldClose; }
50 void pollEvents() override;
51 bool pollEvent(WindowEvent &event) override;
52
53 bool wasResized() const override { return m_frameBufferResized; }
54 void resetResizedFlag() override { m_frameBufferResized = false; }
55
56 private:
57 static LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
58 static KeyCode mapWinKey(WPARAM key);
59 std::queue<WindowEvent> m_eventQueue;
60
61 std::wstring m_title;
62 HWND m_hwnd = nullptr;
63 HINSTANCE m_hInstance = nullptr;
64 WindowSize m_frameBufferSize;
65 bool m_frameBufferResized = false;
66 bool m_shouldClose = false;
67
68 }; // class Win32
69
70} // namespace cae
71
72#endif
This file contains the Window abstract class.
KeyCode
Definition Keyboard.hpp:23
PluginPlatform
Definition IPlugin.hpp:33
PluginType
Definition IPlugin.hpp:22