mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 16:52:57 +00:00
Transformed glfwEnable/Disable/SetCursorMode into glfwGetInputMode/SetInputMode.
This commit is contained in:
+3
-6
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user