SDL Wiki
(This is the legacy documentation for stable SDL2, the current stable version; SDL3 is the current development version.)

SDL_MouseButtonEvent

Mouse button event structure (event.button.*)

Header File

Defined in [SDL_events.h](https://github.com/libsdl-org/SDL/blob/SDL2/include/SDL_events.h), but apps should _only_ `#include "SDL.h"`!

Syntax

typedef struct SDL_MouseButtonEvent
{
    Uint32 type;        /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
    Uint32 timestamp;   /**< In milliseconds, populated using SDL_GetTicks() */
    Uint32 windowID;    /**< The window with mouse focus, if any */
    Uint32 which;       /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
    Uint8 button;       /**< The mouse button index */
    Uint8 state;        /**< ::SDL_PRESSED or ::SDL_RELEASED */
    Uint8 clicks;       /**< 1 for single-click, 2 for double-click, etc. */
    Uint8 padding1;
    Sint32 x;           /**< X coordinate, relative to window */
    Sint32 y;           /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;

Data Fields

Uint32

type

the event type; SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP

Uint32

timestamp

timestamp of the event

Uint32

windowID

the window with mouse focus, if any

Uint32

which

the mouse instance id, or SDL_TOUCH_MOUSEID; see Remarks for details

Uint8

button

the button that changed; see Remarks for details

Uint8

state

the state of the button; SDL_PRESSED or SDL_RELEASED

Uint8

clicks

1 for single-click, 2 for double-click, etc. (>= SDL 2.0.2)

Sint32

x

X coordinate, relative to window

Sint32

y

Y coordinate, relative to window

SDL_EventType
SDL_Event
SDL_MouseMotionEvent
SDL_MouseWheelEvent

CategoryAPI, CategoryAPIStruct, CategoryStruct, CategoryEvents


[ 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.