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