From 2c6b505c564906640a5e9204c30d4f5b5abdd656 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Thu, 8 Jan 2026 20:43:01 +0100 Subject: [PATCH] context_window.cpp is back --- CMakeLists.txt | 1 + include/context_window.hpp | 12 ++---------- src/context_window.cpp | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 src/context_window.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 162c971..da6ab64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ target_sources(${PROJECT_NAME} PRIVATE src/window.cpp src/opengl_context.cpp + src/context_window.cpp PUBLIC FILE_SET public_headers diff --git a/include/context_window.hpp b/include/context_window.hpp index bb2315c..b7fee92 100644 --- a/include/context_window.hpp +++ b/include/context_window.hpp @@ -11,17 +11,9 @@ namespace window { public: ContextWindow() noexcept = delete; - explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept { - glfwSetErrorCallback(error_clbk); - if (glfwInit() == GLFW_FALSE) { - init = false; - } - init = true; - } + explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept; - ~ContextWindow() noexcept { - glfwTerminate(); - } + ~ContextWindow() noexcept; [[nodiscard]] inline bool is_init() const { return init; } }; diff --git a/src/context_window.cpp b/src/context_window.cpp new file mode 100644 index 0000000..0788147 --- /dev/null +++ b/src/context_window.cpp @@ -0,0 +1,15 @@ +#include "context_window.hpp" + +namespace window { + ContextWindow::ContextWindow(const GLFWerrorfun error_clbk) noexcept { + glfwSetErrorCallback(error_clbk); + if (glfwInit() == GLFW_FALSE) { + init = false; + } + init = true; + } + + ContextWindow::~ContextWindow() noexcept { + glfwTerminate(); + } +}