Transformed glfwEnable/Disable/SetCursorMode into glfwGetInputMode/SetInputMode.

This commit is contained in:
Camilla Berglund
2012-02-04 00:51:35 +01:00
parent 011ef7463a
commit ce288a8939
19 changed files with 219 additions and 279 deletions
+3 -6
View File
@@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdlib.h>
static GLboolean cursor_captured = GL_FALSE;
static GLFWwindow window_handle = NULL;
static int cursor_x;
static int cursor_y;
@@ -44,18 +43,16 @@ static GLboolean open_window(void);
static void toggle_mouse_cursor(GLFWwindow window)
{
if (cursor_captured)
if (glfwGetInputMode(window, GLFW_CURSOR_MODE) == GLFW_CURSOR_CAPTURED)
{
printf("Released cursor\n");
glfwSetCursorMode(window, GLFW_CURSOR_NORMAL);
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_NORMAL);
}
else
{
printf("Captured cursor\n");
glfwSetCursorMode(window, GLFW_CURSOR_CAPTURED);
glfwSetInputMode(window, GLFW_CURSOR_MODE, GLFW_CURSOR_CAPTURED);
}
cursor_captured = !cursor_captured;
}
static void mouse_position_callback(GLFWwindow window, int x, int y)