2022-01-08 21:57:17 +01:00
|
|
|
#ifndef BILLYSHEET_WINDOW_HPP
|
|
|
|
#define BILLYSHEET_WINDOW_HPP
|
|
|
|
|
2022-01-17 22:00:26 +01:00
|
|
|
#include <GL/glew.h>
|
|
|
|
#include <GL/gl.h>
|
|
|
|
#include <GLFW/glfw3.h>
|
2022-01-08 21:57:17 +01:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace gui {
|
2024-01-28 20:31:50 +01:00
|
|
|
class Window final {
|
|
|
|
private:
|
|
|
|
static void delete_glfw_window(GLFWwindow *glfWwindow) {
|
|
|
|
glfwDestroyWindow(glfWwindow);
|
|
|
|
glfwTerminate();
|
|
|
|
}
|
2022-01-08 21:57:17 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> wwindow{ nullptr, delete_glfw_window };
|
2022-01-08 21:57:17 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
public:
|
|
|
|
Window();
|
2022-01-08 21:57:17 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
Window(Window &&window) noexcept: wwindow(std::move(window.wwindow)) {}
|
2022-06-09 22:16:23 +02:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
~Window() noexcept = default;
|
2022-01-09 00:43:33 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> &
|
|
|
|
get_window() const { return wwindow; }
|
2022-01-09 00:43:33 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
[[nodiscard]] bool should_close() const noexcept;
|
2022-01-09 00:43:33 +01:00
|
|
|
|
2024-01-28 20:31:50 +01:00
|
|
|
void swap_buffers() const noexcept;
|
|
|
|
};
|
2022-01-08 21:57:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif //BILLYSHEET_WINDOW_HPP
|