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_GetGlobalMouseState - Query the platform for the asynchronous mouse button state and the desktop-

Availability

       This function is available since SDL 3.2.0.

Description

       This function immediately queries the platform for the most recent asynchronous state, more  costly  than
       retrieving SDL's cached state in

       SDL_GetMouseState ().

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

       In Relative Mode, the  platform-cursor's  position  usually  contradicts  the  SDL-cursor's  position  as
       manually calculated from

       SDL_GetMouseState () and

       SDL_GetWindowPosition .

       This  function  can  be  useful  if  you  need  to  track  the  mouse  outside  of  a specific window and
       SDL_CaptureMouse () doesn't fit your needs. For example, it could be useful if  you  need  to  track  the
       mouse while dragging a window, where coordinates relative to a window might not be in sync at all times.

Function Parameters

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

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

Header File

       Defined in SDL3/SDL_mouse.h

Name

       SDL_GetGlobalMouseState  -  Query  the  platform for the asynchronous mouse button state and the desktop-
       relative platform-cursor position.

Return Value

       (  SDL_MouseButtonFlags  )  Returns  a  32-bit  bitmask  of the button state that can be bitwise-compared
       against the

       SDL_BUTTON_MASK (X) macro.

See Also

(3), SDL_CaptureMouse(3), (3), SDL_GetMouseState(3), (3), SDL_GetGlobalMouseState(3)

Simple Directmedia Layer                           SDL 3.2.10                         SDL_GetGlobalMouseState(3)

Synopsis

#include"SDL3/SDL.h"SDL_MouseButtonFlagsSDL_GetGlobalMouseState(float*x,float*y);

Thread Safety

       This function should only be called on the main thread.

See Also