sdlSetWindowRelativeMouseMode function
Set relative mouse mode for a window.
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.
\param window the window to change. \param enabled true to enable relative mode, false to disable. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety This function should only be called on the main thread.
\since This function is available since SDL 3.1.3.
\sa SDL_GetWindowRelativeMouseMode
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled)
Implementation
bool sdlSetWindowRelativeMouseMode(Pointer<SdlWindow> window, bool enabled) {
final sdlSetWindowRelativeMouseModeLookupFunction = libSdl3.lookupFunction<
Uint8 Function(Pointer<SdlWindow> window, Uint8 enabled),
int Function(Pointer<SdlWindow> window,
int enabled)>('SDL_SetWindowRelativeMouseMode');
return sdlSetWindowRelativeMouseModeLookupFunction(window, enabled ? 1 : 0) ==
1;
}