|
evan 2026.1.4
Evan
|
Reference-counted GLFW lifecycle guard. More...
#include <headers/evan/glfw/GlfwContext.hpp>
Public Member Functions | |
| GlfwContext () | |
| Acquires the GLFW library. | |
| ~GlfwContext ()=default | |
| Releases the GLFW library. | |
| GlfwContext (const GlfwContext &)=default | |
| GlfwContext (GlfwContext &&) noexcept=default | |
| GlfwContext & | operator= (const GlfwContext &)=default |
| GlfwContext & | operator= (GlfwContext &&) noexcept=default |
Reference-counted GLFW lifecycle guard.
GLFW is process-global state: glfwInit() and glfwTerminate() must not be paired per platform instance, otherwise destroying one platform tears down GLFW for every other live platform. This guard acquires the library when the first instance is created and releases it when the last instance is destroyed.
The type is copyable and movable; copies share the same underlying reference count (backed by std::shared_ptr).
Definition at line 26 of file GlfwContext.hpp.
| evan::glfw::GlfwContext::GlfwContext | ( | ) |
Acquires the GLFW library.
Increments the global reference count and calls glfwInit() on the first acquisition.
| std::runtime_error | If glfwInit() fails. |
Definition at line 51 of file GlfwContext.cpp.
|
default |
Releases the GLFW library.
Decrements the global reference count and calls glfwTerminate() when the last guard is destroyed.