30 lines
699 B
C++
30 lines
699 B
C++
#ifndef SCRATCHBSDF_CONTEXT_WINDOW_HPP
|
|
#define SCRATCHBSDF_CONTEXT_WINDOW_HPP
|
|
|
|
#include <GLFW/glfw3.h>
|
|
|
|
namespace window {
|
|
class ContextWindow final {
|
|
private:
|
|
bool init{ false };
|
|
|
|
public:
|
|
ContextWindow() noexcept = delete;
|
|
|
|
explicit ContextWindow(const GLFWerrorfun error_clbk) noexcept {
|
|
glfwSetErrorCallback(error_clbk);
|
|
if (glfwInit() == GLFW_FALSE) {
|
|
init = false;
|
|
}
|
|
init = true;
|
|
}
|
|
|
|
~ContextWindow() noexcept {
|
|
glfwTerminate();
|
|
}
|
|
|
|
[[nodiscard]] inline bool is_init() const { return init; }
|
|
};
|
|
} // window
|
|
|
|
#endif //SCRATCHBSDF_CONTEXT_WINDOW_HPP
|