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(); + } +}