sdl2-2.0.0: Both high- and low-level bindings to the SDL library (version 2.0.3).

Safe HaskellNone
LanguageHaskell2010

SDL.Input.Mouse

Contents

Synopsis

Relative Mouse Mode

setRelativeMouseMode :: (Functor m, MonadIO m) => Bool -> m () Source

Sets the current relative mouse mode.

When relative mouse mode is enabled, cursor is hidden and mouse position will not change. However, you will be delivered relative mouse position change events.

Throws SDLException on failure.

getRelativeMouseMode :: MonadIO m => m Bool Source

Check if relative mouse mode is enabled.

Mouse and Touch Input

data MouseDevice Source

Identifies what kind of mouse-like device this is.

Constructors

Mouse !Int

An actual mouse. The number identifies which mouse.

Touch

Some sort of touch device.

Mouse State

getMouseLocation :: MonadIO m => m (Point V2 CInt) Source

Retrieve the current location of the mouse, relative to the currently focused window.

getMouseButtons :: MonadIO m => m (MouseButton -> Bool) Source

Retrieve a mapping of which buttons are currently held down.

Warping the Mouse

warpMouse :: MonadIO m => WarpMouseOrigin -> Point V2 CInt -> m () Source

Move the current location of a mouse pointer. The WarpMouseOrigin specifies the origin for the given warp coordinates.

Cursor Visibility

cursorVisible :: StateVar Bool Source

Get or set whether the cursor is currently visible.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_ShowCursor and SDL_HideCursor for C documentation.

Cursor Shape

data Cursor Source

Instances

activeCursor :: StateVar Cursor Source

Get or set the currently active cursor. You can create new Cursors with createCursor.

This StateVar can be modified using $= and the current value retrieved with get.

See SDL_SetCursor and SDL_GetCursor for C documentation.

createCursor Source

Arguments

:: MonadIO m 
=> Vector Bool

Whether this part of the cursor is black. Use False for white and True for black.

-> Vector Bool

Whether or not pixels are visible. Use True for visible and False for transparent.

-> V2 CInt

The width and height of the cursor.

-> Point V2 CInt

The X- and Y-axis location of the upper left corner of the cursor relative to the actual mouse position

-> m Cursor 

Create a cursor using the specified bitmap data and mask (in MSB format).

freeCursor :: MonadIO m => Cursor -> m () Source

Free a cursor created with createCursor and createColorCusor.

See SDL_FreeCursor for C documentation.

createColorCursor Source

Arguments

:: MonadIO m 
=> Surface 
-> Point V2 CInt

The location of the cursor hot spot

-> m Cursor 

Create a color cursor.

See SDL_CreateColorCursor for C documentation.