Change library to make it less buggy when destroying objects
# Conflicts: # include/window.hpp # src/window.cpp
This commit is contained in:
parent
32b6c523c3
commit
bc12874c80
5 changed files with 71 additions and 52 deletions
|
@ -28,39 +28,33 @@ namespace gui {
|
|||
|
||||
static void window_pos_callback(GLFWwindow *window, int xpos, int ypos);
|
||||
|
||||
static void delete_glfw_window(GLFWwindow *glfWwindow) {
|
||||
glfwDestroyWindow(glfWwindow);
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
static std::uint_fast8_t count_instance;
|
||||
|
||||
std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> wwindow{ nullptr, delete_glfw_window };
|
||||
std::unique_ptr<GLFWwindow, decltype(&glfwDestroyWindow)> wwindow{ nullptr, glfwDestroyWindow };
|
||||
|
||||
modulesType modules;
|
||||
|
||||
bool valid{ false };
|
||||
|
||||
explicit Window(const bool debugOpengl,
|
||||
const GLFWframebuffersizefun framebufferCallback,
|
||||
GLFWwindow *shared,
|
||||
std::initializer_list<modulesType::value_type> initializer);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static bool init_glfw(GLFWerrorfun errorCallback) noexcept;
|
||||
|
||||
Window() noexcept = delete;
|
||||
|
||||
Window(Window &&window) noexcept = default;
|
||||
Window(const Window &) = delete;
|
||||
|
||||
Window(Window &&window) noexcept;
|
||||
|
||||
[[nodiscard]] static std::optional<Window> create_window(
|
||||
const GLFWerrorfun errorCallback,
|
||||
GLFWframebuffersizefun framebufferCallback,
|
||||
const bool debugOpengl,
|
||||
GLFWwindow *shared,
|
||||
std::initializer_list<modulesType::value_type> initializer) noexcept;
|
||||
|
||||
~Window() noexcept;
|
||||
~Window() noexcept = default;
|
||||
|
||||
[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)> &get_window() const noexcept;
|
||||
[[nodiscard]] const std::unique_ptr<GLFWwindow, decltype(&glfwDestroyWindow)> &get_window() const noexcept;
|
||||
|
||||
[[nodiscard]] bool should_close() const noexcept;
|
||||
|
||||
|
@ -75,7 +69,9 @@ namespace gui {
|
|||
*/
|
||||
void get_context() const noexcept;
|
||||
|
||||
Window &operator=(Window &&other) noexcept = default;
|
||||
Window &operator=(const Window &) = delete;
|
||||
|
||||
Window &operator=(Window &&other) noexcept;
|
||||
};
|
||||
|
||||
void color_10_bits() noexcept;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue