mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 16:44:11 +00:00
Made window-related callbacks per-window.
This makes polymorphic behaviour easier to implement and avoids the problem of events being triggered before the GLFW window object is fully usable.
This commit is contained in:
+4
-4
@@ -86,10 +86,6 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetCursorPosCallback(cursor_position_callback);
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
glfwSetKeyCallback(key_callback);
|
||||
|
||||
window = glfwCreateWindow(window_width, window_height, GLFW_WINDOWED, "", NULL);
|
||||
if (!window)
|
||||
{
|
||||
@@ -99,6 +95,10 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetCursorPosCallback(window, cursor_position_callback);
|
||||
glfwSetWindowSizeCallback(window, window_size_callback);
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
|
||||
Reference in New Issue
Block a user