mirror of
https://github.com/glfw/glfw.git
synced 2026-09-21 08:39:45 +00:00
Replaced GLFW_MOUSE_CURSOR enable with glfwSetCursorMode.
This commit is contained in:
+1
-1
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user