Wiki Page Content

Differences between revisions 8 and 9
Revision 8 as of 2011-01-17 18:10:01
Size: 1999
Editor: SheenaSmith
Comment: update content - w/ Sam (in progress)
Revision 9 as of 2011-01-17 18:17:23
Size: 1342
Editor: SheenaSmith
Comment: update content - w/ Sam; remove draft
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
||<tablewidth="100%" style="color: #FF0000;" :> DRAFT||
Line 13: Line 12:
||Uint8||'''button'''||the index of the button that reported the event|| ||Uint8||'''button'''||the button that changed; see [[#Remarks|Remarks]] for details||
Line 26: Line 25:
An SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP event occurs whenever a user presses a button on a mouse. An SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP event occurs whenever a user presses or releases a button on a mouse.
Line 28: Line 27:
When a mouse button press or release is detected the number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into '''button''', the position of the mouse when this event occurred is stored in the '''x''' and the '''y''' fields. ,,Like [[SDL_KeyboardEvent]], ,,information on whether the event was a press or a release event is stored in both the '''type''' and '''state''' fields, ,,but this should be obvious,,.

Mouse wheel events are reported as buttons 4 (up) and 5 (down). Two events are generated i.e. you get an SDL_MOUSEBUTTONDOWN followed by an SDL_MOUSEBUTTONUP event.*
<<Color2(green,Should it read 4 (forward) and 5 (backward) instead of up and down or is a mouse wheel event a click on the wheel like a center button instead of a roll action?)>>
'''button''' may be one of:
||SDL_BUTTON_LEFT||
||SDL_BUTTON_MIDDLE||
||SDL_BUTTON_RIGHT||
||SDL_BUTTON_X1||
||SDL_BUTTON_X2||
Line 41: Line 42:
 .[[SDL_GetMouseState]]
 .[[SDL_GetRelativeMouseState]]

SDL_MouseButtonEvent

A structure that contains mouse button event information.

Data Fields

Uint32

type

SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP

Uint32

windowID

the window with mouse focus, if any

Uint8

button

the button that changed; see Remarks for details

Uint8

state

SDL_PRESSED or SDL_RELEASED

int

x

X coordinate, relative to window

int

y

Y coordinate, relative to window

Code Examples

You can add your code example here

Remarks

SDL_MouseButtonEvent is a member of the SDL_Event structure and is used when an event of type SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP is reported.

An SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP event occurs whenever a user presses or releases a button on a mouse.

button may be one of:

SDL_BUTTON_LEFT

SDL_BUTTON_MIDDLE

SDL_BUTTON_RIGHT

SDL_BUTTON_X1

SDL_BUTTON_X2


CategoryStruct, CategoryEvents

None: SDL_MouseButtonEvent (last edited 2014-01-18 19:23:56 by PhilippWiesemann)

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