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.
41
+
m_last_size_windowed = size(); //Get the actual size of the window after creation. Per GLFW docs, this may not be the same as the requested size.
glfwMakeContextCurrent(m_handle); // Set this window as the context for GL render calls.
48
46
49
47
{ // Set the GLFW callbacks.
50
48
// GLFW is a C library requiring static || global functions for callbacks.
51
49
// 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});});
53
+
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
57
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 +75,7 @@ namespace Platform
76
75
icon.height = icon_image.height;
77
76
glfwSetWindowIcon(m_handle, 1, &icon);
78
77
}
78
+
79
79
LOG("[WINDOW] Created Window with resolution {}x{}", size().x, size().y);
80
80
}
81
81
Window::~Window() noexcept
@@ -85,46 +85,63 @@ namespace Platform
85
85
LOG("[WINDOW] Closed window");
86
86
}
87
87
88
-
voidWindow::set_size(glm::uvec2 p_new_size)
88
+
glm::uvec2 Window::size() const
89
89
{
90
-
if (p_new_size.x == 0 || p_new_size.y == 0) // When the window is minimised the size can be 0. Ignore and keep original size data.
0 commit comments