Scroll to navigation

SDL_SetWindowRelativeMouseMode(3) SDL3 FUNCTIONS SDL_SetWindowRelativeMouseMode(3)

NAME

SDL_SetWindowRelativeMouseMode - Set relative mouse mode for a window.

HEADER FILE

Defined in SDL3/SDL_mouse.h

SYNOPSIS

#include "SDL3/SDL.h"
bool SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled);

DESCRIPTION

While the window has focus and relative mouse mode is enabled, the cursor is hidden, the mouse position is constrained to the window, and SDL will report continuous relative mouse motion even if the mouse is at the edge of the window.

This function will flush any pending mouse motion for this window.

FUNCTION PARAMETERS

the window to change.
true to enable relative mode, false to disable.

RETURN VALUE

Returns true on success or false on failure; call

SDL_GetError () for more information.

AVAILABILITY

This function is available since SDL 3.1.3.

SEE ALSO

(3), SDL_GetWindowRelativeMouseMode(3)

SDL 3.1.6 Simple Directmedia Layer