Answers for "SDL Mouse State"

0

SDL Mouse State

int x, y;
Uint32 buttons;

SDL_PumpEvents();  // make sure we have the latest mouse state.

buttons = SDL_GetMouseState(&x, &y);

SDL_Log("Mouse cursor is at %d, %d", x, y);
if ((buttons & SDL_BUTTON_LMASK) != 0) {
    SDL_Log("Mouse Button 1 (left) is pressed.");
}
Posted by: Guest on January-24-2022

Browse Popular Code Answers by Language