18.8Class SDLMouseState

Allows querying of current mouse status.

Class SDLMouseState

This class is used to wrap mouse event collection functions SDL_GetMouseState and SDL_GetRelativeMouseState.

To query the state of the mouse, it is necessary to create an instance of this class, and then call its refresh() method.

If the program doesn't call periodically event dispatching routines or if it doesn't pump events through SDL.PumpEvents, then it is necessary to use the pumpAndRefresh() method for the contents of this class to be updated.

Properties
state Mouse button pression state.
x Current mouse x position
xrel Relative x movement with respect to last check.
y Current mouse y position
yrel Relative y movement with respect to last check.
Methods
PumpAndRefreshPeeks incoming events into SDL and then refresh current mouse position and status.
RefreshRefresh current mouse position and status.

Properties

state

Mouse button pression state.

Mouse button pression state.

x

Current mouse x position

Current mouse x position

xrel

Relative x movement with respect to last check.

Relative x movement with respect to last check.

y

Current mouse y position

Current mouse y position

yrel

Relative y movement with respect to last check.

Relative y movement with respect to last check.

Methods

PumpAndRefresh

Peeks incoming events into SDL and then refresh current mouse position and status.

SDLMouseState.PumpAndRefresh()

This method internally performs a SDL.PumpEvents call before calling the refresh method.

Refresh

Refresh current mouse position and status.

SDLMouseState.Refresh()

Use this method only if the program pumps events or waits for them regularly. Otherwise, use SDLMouseState.PumpAndRefresh.

See also: SDL, SDL, SDL.

Made with http://www.falconpl.org