hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/core/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/window.cpp')
-rw-r--r--src/core/window.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/window.cpp b/src/core/window.cpp
index d3c1ff5..090fc47 100644
--- a/src/core/window.cpp
+++ b/src/core/window.cpp
@@ -24,6 +24,8 @@ namespace Donut
{
DONUT_INFO("Initializing window: ", m_title, " (", m_width, "x", m_height, ")");
+ glfwSetErrorCallback(glfw_error_callback);
+
if (!s_glfw_initialized)
{
int success = glfwInit();
@@ -43,19 +45,21 @@ namespace Donut
}
else
{
-#ifdef __APPLE__
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
+#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GLFW_TRUE);
#endif
}
+ glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
m_window = glfwCreateWindow(m_width, m_height, m_title.c_str(), nullptr, nullptr);
if (!m_window)
{
DONUT_ERROR("Could not create GLFW window!");
glfwTerminate();
+ s_glfw_initialized = false;
return;
}
@@ -65,7 +69,6 @@ namespace Donut
glfwMakeContextCurrent(m_window);
glfwSetWindowUserPointer(m_window, this);
- glfwSetErrorCallback(glfw_error_callback);
glfwSetWindowCloseCallback(m_window, glfw_window_close_callback);
glfwSetWindowSizeCallback(m_window, glfw_window_size_callback);
glfwSetWindowFocusCallback(m_window, glfw_window_focus_callback);
@@ -82,6 +85,7 @@ namespace Donut
auto Window::shutdown() -> void
{
DONUT_INFO("Shutting down window: ", m_title);
+ if (!m_window) return;
glfwDestroyWindow(m_window);
s_glfw_window_count--;