Replaced GLFW_MOUSE_CURSOR enable with glfwSetCursorMode.

This commit is contained in:
Camilla Berglund
2011-09-06 13:55:29 +02:00
parent 4fb55781f1
commit b1656d7323
14 changed files with 221 additions and 184 deletions
+1 -1
View File
@@ -91,7 +91,7 @@ int main(void)
}
glfwSwapInterval(1);
glfwEnable(window, GLFW_MOUSE_CURSOR);
glfwSetCursorMode(window, GLFW_CURSOR_NORMAL);
glfwSetWindowFocusCallback(window_focus_callback);
glfwSetKeyCallback(window_key_callback);
+5 -5
View File
@@ -35,19 +35,19 @@
#include <stdio.h>
#include <stdlib.h>
static GLboolean cursor_enabled = GL_TRUE;
static GLboolean cursor_captured = GL_FALSE;
static GLFWwindow window_handle = NULL;
static GLboolean open_window(void);
static void toggle_mouse_cursor(GLFWwindow window)
{
if (cursor_enabled)
glfwDisable(window, GLFW_MOUSE_CURSOR);
if (cursor_captured)
glfwSetCursorMode(window, GLFW_CURSOR_NORMAL);
else
glfwEnable(window, GLFW_MOUSE_CURSOR);
glfwSetCursorMode(window, GLFW_CURSOR_CAPTURED);
cursor_enabled = !cursor_enabled;
cursor_captured = !cursor_captured;
}
static void mouse_position_callback(GLFWwindow window, int x, int y)