Wiki Page Content

Differences between revisions 10 and 11
Revision 10 as of 2011-01-17 18:24:00
Size: 1929
Editor: SheenaSmith
Comment: update content - w/ Sam (in progress)
Revision 11 as of 2011-01-17 18:35:14
Size: 2248
Editor: SheenaSmith
Comment: update content - w/ Sam (in progress)
Deletions are marked like this. Additions are marked like this.
Line 13: Line 13:
||Uint8||'''state'''||the current button state|| ||Uint8||'''state'''||the current button state; see [[#Remarks|Remarks]] for details||
Line 26: Line 26:
<<Color2(green,The following was taken from the old 1.2 wiki and may not be applicable to 1.3.)>>
Line 32: Line 30:
The button state can be interpreted using the SDL_BUTTON macro (see [[SDL_GetMouseState]]()). '''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 SDL_BUTTON(X) macros with the following masks:
||SDL_BUTTON_LMASK||SDL_BUTTON(SDL_BUTTON_LEFT)||
||SDL_BUTTON_MMASK||SDL_BUTTON(SDL_BUTTON_MIDDLE)||
||SDL_BUTTON_RMASK||SDL_BUTTON(SDL_BUTTON_RIGHT)||
||SDL_BUTTON_X1MASK||SDL_BUTTON(SDL_BUTTON_X1)||
||SDL_BUTTON_X2MASK||SDL_BUTTON(SDL_BUTTON_X2)||

DRAFT

SDL_MouseMotionEvent

A structure that contains mouse motion event information.

Data Fields

Uint32

type

SDL_MOUSEMOTION

Uint32

windowID

the window with mouse focus, if any

Uint8

state

the current button state; see 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

Code Examples

You can add your code example here

Remarks

SDL_MouseMotionEvent is a member of the SDL_Event structure and is used when an event of type SDL_MOUSEMOTION is reported.

An SDL_MOUSEMOTION event occurs whenever a user moves the mouse within the application window or when SDL_WarpMouseInWindow() is called.

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 SDL_BUTTON(X) macros with the following masks:

SDL_BUTTON_LMASK

SDL_BUTTON(SDL_BUTTON_LEFT)

SDL_BUTTON_MMASK

SDL_BUTTON(SDL_BUTTON_MIDDLE)

SDL_BUTTON_RMASK

SDL_BUTTON(SDL_BUTTON_RIGHT)

SDL_BUTTON_X1MASK

SDL_BUTTON(SDL_BUTTON_X1)

SDL_BUTTON_X2MASK

SDL_BUTTON(SDL_BUTTON_X2)

If the cursor is hidden (SDL_ShowCursor(0)) and the input is grabbed (SDL_WM_GrabInput(SDL_GRAB_ON)), then the mouse will give relative motion events even when the cursor reaches the edge of the screen. This is currently only implemented on Windows and Linux/Unix-alikes.

green


CategoryStruct, CategoryEvents

None: SDL_MouseMotionEvent (last edited 2013-09-05 20:20:21 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit