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