logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_GetMouseState - Query SDL's cache for the synchronous mouse button state and the window-relative SDL-

Availability

       This function is available since SDL 3.2.0.

Description

       This  function returns the cached synchronous state as SDL understands it from the last pump of the event
       queue.

       To query the platform for immediate asynchronous state, use SDL_GetGlobalMouseState.

       Passing non-NULL pointers to x or y will write  the  destination  with  respective  x  or  y  coordinates
       relative to the focused window.

       In  Relative  Mode,  the  SDL-cursor's  position  usually  contradicts  the platform-cursor's position as
       manually calculated from SDL_GetGlobalMouseState() and SDL_GetWindowPosition.

Function Parameters

x      a pointer to receive the SDL-cursor's x-position from the focused window's top left corner, can be
              NULL if unused.

       y      a pointer to receive the SDL-cursor's y-position from the focused window's top left corner, can be
              NULL if unused.

Name

       SDL_GetMouseState - Query SDL's cache for the synchronous mouse button state and the window-relative SDL-
       cursor position.

Return Value

       Returns a 32-bit bitmask of the button state that can be bitwise-compared against the  SDL_BUTTON_MASK(X)
       macro.

See Also

SDL_GetGlobalMouseState(3), SDL_GetRelativeMouseState(3)

Simple Directmedia Layer                           SDL 3.2.20                               SDL_GetMouseState(3)

Synopsis

#include<SDL3/SDL_mouse.h>SDL_MouseButtonFlagsSDL_GetMouseState(float*x,float*y);

Thread Safety

       This function should only be called on the main thread.

See Also