JustEnoughMod
Loading...
Searching...
No Matches
Window.hpp
1#ifndef CORE_WINDOW_HPP
2#define CORE_WINDOW_HPP
3
4#include <core/AppModule.hpp>
5
6#include <GLFW/glfw3.h>
7#include <utility>
8
9namespace JEM {
11 uint32_t count;
12 const char **names;
13 };
14
15 class Window : public AppModule {
16 public:
17 Window(std::shared_ptr<Application> app, std::string title, int width, int height);
18
19 ~Window();
20
21 auto pollEvent() -> void;
22
23 [[nodiscard]] auto getSize() const -> std::pair<int, int>;
24
25 [[nodiscard]] auto getWidth() const -> int {
26 auto [width, height] = getSize();
27 return width;
28 }
29
30 [[nodiscard]] auto getHeight() const -> int {
31 auto [width, height] = getSize();
32 return height;
33 }
34
35 [[nodiscard]] auto getInstanceExtensions() const -> InstanceExtensions;
36
37 [[nodiscard]] auto getNative() const -> std::shared_ptr<GLFWwindow> {
38 return m_window;
39 }
40
41 private:
42 static inline unsigned int m_count = 0;
43 std::shared_ptr<GLFWwindow> m_window;
44 std::string m_title;
45
46 static auto errorCallback(int error_code, const char *description) -> void;
47
48 static auto cursorPosCallback(GLFWwindow *window, double xpos, double ypos) -> void;
49 static auto windowCloseCallback(GLFWwindow *window) -> void;
50 static auto mouseButtonCallback(GLFWwindow *window, int button, int action, int mods) -> void;
51 static auto scrollCallback(GLFWwindow *window, double xoffset, double yoffset) -> void;
52 static auto keyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) -> void;
53 static auto charCallback(GLFWwindow *window, unsigned int codepoint) -> void;
54 };
55} // namespace JEM
56
57#endif
Definition AppModule.hpp:9
Definition Window.hpp:15
Definition Window.hpp:10