Moved callback setting to before window creation.

This commit is contained in:
Camilla Berglund 2011-02-27 21:42:09 +01:00
parent e0ba9e4e1f
commit 3a755b99d0

View File

@ -339,6 +339,17 @@ int main(void)
printf("Library initialized\n"); printf("Library initialized\n");
glfwSetWindowSizeCallback(window_size_callback);
glfwSetWindowCloseCallback(window_close_callback);
glfwSetWindowRefreshCallback(window_refresh_callback);
glfwSetWindowFocusCallback(window_focus_callback);
glfwSetWindowIconifyCallback(window_iconify_callback);
glfwSetMouseButtonCallback(mouse_button_callback);
glfwSetMousePosCallback(mouse_position_callback);
glfwSetScrollCallback(scroll_callback);
glfwSetKeyCallback(key_callback);
glfwSetCharCallback(char_callback);
window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL); window = glfwOpenWindow(0, 0, GLFW_WINDOWED, "Event Linter", NULL);
if (!window) if (!window)
{ {
@ -352,17 +363,6 @@ int main(void)
glfwSwapInterval(1); glfwSwapInterval(1);
glfwSetWindowSizeCallback(window_size_callback);
glfwSetWindowCloseCallback(window_close_callback);
glfwSetWindowRefreshCallback(window_refresh_callback);
glfwSetWindowFocusCallback(window_focus_callback);
glfwSetWindowIconifyCallback(window_iconify_callback);
glfwSetMouseButtonCallback(mouse_button_callback);
glfwSetMousePosCallback(mouse_position_callback);
glfwSetScrollCallback(scroll_callback);
glfwSetKeyCallback(key_callback);
glfwSetCharCallback(char_callback);
printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled"); printf("Key repeat should be %s\n", keyrepeat ? "enabled" : "disabled");
printf("System keys should be %s\n", systemkeys ? "enabled" : "disabled"); printf("System keys should be %s\n", systemkeys ? "enabled" : "disabled");