From a4c43b052203b73337179f413dde6f5212e34c08 Mon Sep 17 00:00:00 2001 From: Manuel Kraemer Date: Sat, 16 Mar 2013 18:44:53 -0700 Subject: [PATCH] fix some GLFW 3.0 issues - since we are still in beta, the API is changing a bit - the closeWindowFun callback changed prototype (now returns void) - keyboard functions now require the window handle (and pass it to the callback) --- examples/glViewer/viewer.cpp | 6 ++++-- examples/paintTest/main.cpp | 14 ++++++++------ examples/simpleCpu/main.cpp | 6 ++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/examples/glViewer/viewer.cpp b/examples/glViewer/viewer.cpp index 5e5a3611..c00daf20 100644 --- a/examples/glViewer/viewer.cpp +++ b/examples/glViewer/viewer.cpp @@ -1531,13 +1531,15 @@ reshape(int width, int height) { //------------------------------------------------------------------------------ #if GLFW_VERSION_MAJOR>=3 -int windowClose(GLFWwindow*) { +void windowClose(GLFWwindow*) { + g_running = false; +} #else int windowClose() { -#endif g_running = false; return GL_TRUE; } +#endif //------------------------------------------------------------------------------ static void diff --git a/examples/paintTest/main.cpp b/examples/paintTest/main.cpp index c503f20c..8d4df4b7 100644 --- a/examples/paintTest/main.cpp +++ b/examples/paintTest/main.cpp @@ -1011,12 +1011,12 @@ drawStroke(int x, int y) //------------------------------------------------------------------------------ static void #if GLFW_VERSION_MAJOR>=3 -motion(GLFWwindow *, int x, int y) { +motion(GLFWwindow * w, int x, int y) { #else motion(int x, int y) { #endif - if (glfwGetKey(GLFW_KEY_LALT)) { + if (glfwGetKey(w,GLFW_KEY_LALT)) { if (g_mbutton[0] && !g_mbutton[1] && !g_mbutton[2]) { // orbit g_rotate[0] += x - g_prev_x; @@ -1045,7 +1045,7 @@ motion(int x, int y) { //------------------------------------------------------------------------------ static void #if GLFW_VERSION_MAJOR>=3 -mouse(GLFWwindow *, int button, int state) { +mouse(GLFWwindow * w, int button, int state) { #else mouse(int button, int state) { #endif @@ -1057,7 +1057,7 @@ mouse(int button, int state) { g_mbutton[button] = (state == GLFW_PRESS); } - if (not glfwGetKey(GLFW_KEY_LALT)) { + if (not glfwGetKey(w, GLFW_KEY_LALT)) { if (g_mbutton[0] && !g_mbutton[1] && !g_mbutton[2]) { drawStroke(g_prev_x, g_prev_y); } @@ -1092,13 +1092,15 @@ reshape(int width, int height) { //------------------------------------------------------------------------------ #if GLFW_VERSION_MAJOR>=3 -int windowClose(GLFWwindow*) { +void windowClose(GLFWwindow*) { + g_running = false; +} #else int windowClose() { -#endif g_running = false; return GL_TRUE; } +#endif //------------------------------------------------------------------------------ static void diff --git a/examples/simpleCpu/main.cpp b/examples/simpleCpu/main.cpp index 13aca686..c06d4958 100644 --- a/examples/simpleCpu/main.cpp +++ b/examples/simpleCpu/main.cpp @@ -67,13 +67,15 @@ reshape(int width, int height) { } #if GLFW_VERSION_MAJOR>=3 -int windowClose(GLFWwindow*) { +void windowClose(GLFWwindow*) { + g_running = false; +} #else int windowClose() { -#endif g_running = false; return GL_TRUE; } +#endif // // Idle is called between frames, here we advance the frame number and update