captureMouse()

Environment

Description

Locks the cursor to the window and enables raw mouse input, removing OS acceleration. Essential for FPS-style games. Use releaseMouse() to unlock.

Syntax

void captureMouse()

Parameters

None

Returns

void

Related

Under the Hood

From Processing.h:

void captureMouse();

Under the Hood

From Processing.cpp:

void PApplet::captureMouse() {if(gWindow){glfwSetInputMode(gWindow,GLFW_CURSOR,GLFW_CURSOR_DISABLED); // Enable raw motion if supported (removes OS acceleration) if(glfwRawMouseMotionSupported()) glfwSetInputMode(gWindow,GLFW_RAW_MOUSE_MOTION,GLFW_TRUE);}}