BillySheet/src/window.cpp

18 lines
618 B
C++
Raw Normal View History

#include "window.hpp"
2022-01-08 23:40:31 +01:00
#include <stdexcept>
#include <spdlog/spdlog.h>
static void glfwErrorCallback(int error, const char *message) {
spdlog::error("Error code {}: {}", error, message);
}
gui::Window::Window() {
2022-01-08 23:40:31 +01:00
glfwSetErrorCallback(glfwErrorCallback);
if (glfwInit() == GLFW_FALSE) {
throw std::runtime_error("GLFW init failed.");
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
wwindow = std::unique_ptr<GLFWwindow, decltype(&delete_glfw_window)>(glfwCreateWindow(600, 800, "Billy Sheet tracker", nullptr, nullptr),
delete_glfw_window);
}