SDL Wiki
(This is the documentation for SDL3, which is the current stable version. SDL2 was the previous version!)

SDL_SetWindowRelativeMouseMode

Set relative mouse mode for a window.

Header File

Defined in <SDL3/SDL_mouse.h>

Syntax

bool SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled);

Function Parameters

SDL_Window * window the window to change.
bool enabled true to enable relative mode, false to disable.

Return Value

(bool) Returns true on success or false on failure; call SDL_GetError() for more information.

Remarks

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.

Version

This function is available since SDL 3.1.3.

See Also


CategoryAPI, CategoryAPIFunction, CategoryMouse


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.