|
Size: 2266
Comment: add 'which' field
|
Size: 2279
Comment: Updated types to match SDL_events.h.
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 13: | Line 13: |
| ||Uint8||'''state'''||the state of the button; see [[#Remarks|Remarks]] for details|| ||int||'''x'''||X coordinate, relative to window|| ||int||'''y'''||Y coordinate, relative to window|| ||int||'''xrel'''||relative motion in the X direction|| ||int||'''yrel'''||relative motion in the Y direction|| |
||Uint32||'''state'''||the state of the button; see [[#Remarks|Remarks]] for details|| ||Sint32||'''x'''||X coordinate, relative to window|| ||Sint32||'''y'''||Y coordinate, relative to window|| ||Sint32||'''xrel'''||relative motion in the X direction|| ||Sint32||'''yrel'''||relative motion in the Y direction|| |
| Line 30: | Line 30: |
| '''state''' is an 8-bit button bitmask of the current button state and is the same as that returned by [[SDL_GetMouseState]](). You can test different buttons by using the following masks: | '''state''' is a 32-bit button bitmask of the current button state and is the same as that returned by [[SDL_GetMouseState]](). You can test different buttons by using the following masks: |
SDL_MouseMotionEvent
A structure that contains mouse motion event information.
Contents
Data Fields
Uint32 |
type |
the event type; SDL_MOUSEMOTION |
Uint32 |
windowID |
the window with mouse focus, if any |
Uint32 |
which |
the mouse instance id, or SDL_TOUCH_MOUSEID; see Remarks for details |
Uint32 |
state |
the state of the button; see Remarks for details |
Sint32 |
x |
X coordinate, relative to window |
Sint32 |
y |
Y coordinate, relative to window |
Sint32 |
xrel |
relative motion in the X direction |
Sint32 |
yrel |
relative motion in the Y direction |
Code Examples
You can add your code example here
Remarks
SDL_MouseMotionEvent is a member of the SDL_Event union and is used when an event of type SDL_MOUSEMOTION is reported. You would access it through the event's motion field.
An SDL_MOUSEMOTION event occurs whenever a user moves the mouse within the application window or when SDL_WarpMouseInWindow() is called.
state is a 32-bit button bitmask of the current button state and is the same as that returned by SDL_GetMouseState(). You can test different buttons by using the following masks:
SDL_BUTTON_LMASK |
SDL_BUTTON_MMASK |
SDL_BUTTON_RMASK |
SDL_BUTTON_X1MASK |
SDL_BUTTON_X2MASK |
which may be SDL_TOUCH_MOUSEID, for events that were generated by a touch input device, and not a real mouse. You might want to ignore such events, if your application already handles SDL_TouchFingerEvent.
Relative motion is stored in xrel and yrel and is relative to the last motion event. If relative mouse mode is enabled with SDL_SetRelativeMouseMode(), then the mouse will give relative motion events even when the cursor reaches the edge of the screen.
Related Enumerations
Related Structures
