You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added handling for content scaling changes to update UI.
Refactored Window constructed in windowed mode to begin in the middle of the screen at half its size.
Fixed bad state sync for size and position via set_size and set_position by adding on_x_callback.
glfwSetWindowSize(m_handle, window_size.x, window_size.y); // glfwCreateWindow size requests are not hard constraints. Have to ensure size was set by calling glfwSetWindowSize.
47
60
set_VSync(m_VSync);
48
61
49
62
{ // Set the GLFW callbacks.
50
63
// GLFW is a C library requiring static || global functions for callbacks.
51
64
// We use the glfwSetWindowUserPointer and glfwGetWindowUserPointer to retrieve this instance of Window from the library and call the member functions.
glfwSetWindowSizeCallback(m_handle, [](GLFWwindow* p_handle, int p_size_x, int p_size_y){((Window*)glfwGetWindowUserPointer(p_handle))->set_size({p_size_x, p_size_y});});
55
-
glfwSetWindowPosCallback(m_handle, [](GLFWwindow* p_handle, int p_pos_x, int p_pos_y){((Window*)glfwGetWindowUserPointer(p_handle))->set_position({p_pos_x, p_pos_y});});
glfwSetWindowSizeCallback(m_handle, [](GLFWwindow* p_handle, int p_size_x, int p_size_y){((Window*)glfwGetWindowUserPointer(p_handle))->on_size_callback({p_size_x, p_size_y});});
68
+
glfwSetWindowPosCallback(m_handle, [](GLFWwindow* p_handle, int p_pos_x, int p_pos_y){((Window*)glfwGetWindowUserPointer(p_handle))->on_position_callback({p_pos_x, p_pos_y});});
{ // INPUT CALLBACKS - Because we only have access to the WindowUserPointer via GLFW, we have to access the Input and set it from the window.
58
72
glfwSetKeyCallback(m_handle, [](GLFWwindow* p_handle, int p_key, int p_scancode, int p_action, int p_mode){((Window*)glfwGetWindowUserPointer(p_handle))->m_input.glfw_key_press(p_key, p_scancode, p_action, p_mode);});
@@ -76,6 +90,8 @@ namespace Platform
76
90
icon.height = icon_image.height;
77
91
glfwSetWindowIcon(m_handle, 1, &icon);
78
92
}
93
+
94
+
ASSERT(m_aspect_ratio != 0.f, "[WINDOW] Aspect ratio badly initialised");
79
95
LOG("[WINDOW] Created Window with resolution {}x{}", size().x, size().y);
0 commit comments