mouse

package
Version: v0.0.0-...-7296e18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// OnButtonDown is called when the a button on the mouse is pressed down.
	OnButtonDown func(x, y float32, button Button)
	// OnButtonUp is called when the a button on the mouse is released.
	OnButtonUp func(x, y float32, button Button)
	// OnMove is called when the mouse is moved.
	OnMove func(x, y, dx, dy float32)
	// OnFocus is called when the program has mouse focus or loses mouse focus.
	OnFocus func(has_focus bool)
	// OnWheelMove is called when the mouse wheel is changed
	OnWheelMove func(x, y float32)
)

Functions

func Delegate

func Delegate(event sdl.Event)

Delegate is used by amore/event to pass events to the mouse package. It may also be useful to stub or fake events

func GetCursor

func GetCursor() *sdl.Cursor

GetCursor gets the current Cursor the program is using.

func GetPosition

func GetPosition() (float32, float32)

GetPosition returns the current position of the mouse.

func GetRelativeMode

func GetRelativeMode() bool

GetRelativeMode gets whether relative mode is enabled for the mouse.

func GetSystemCursor

func GetSystemCursor(name string) *sdl.Cursor

GetSystemCursor Gets a Cursor object representing a system-native hardware cursor.

func GetX

func GetX() float32

GetX returns the current x-position of the mouse.

func GetY

func GetY() float32

GetY returns the current y-position of the mouse.

func IsDown

func IsDown(button Button) bool

IsDown checks whether a certain button is down.

func IsGrabbed

func IsGrabbed() bool

IsGrabbed checks if the mouse is grabbbed with pointer lock.

func IsVisible

func IsVisible() bool

IsVisible checks if the cursor is visible.

func NewCursor

func NewCursor(filename string, hx, hy int) (*sdl.Cursor, error)

NewCursor creates a new hardware Cursor object from an image.

func SetCursor

func SetCursor(cursor *sdl.Cursor)

SetCursor sets the current mouse cursor.

func SetGrabbed

func SetGrabbed(enabled bool)

SetGrabbed grabs the mouse and confines it to the window.

func SetPosition

func SetPosition(x, y float32)

SetPosition sets the current position of the mouse.

func SetRelativeMode

func SetRelativeMode(isvisible bool)

SetRelativeMode sets whether relative mode is enabled for the mouse.

func SetVisible

func SetVisible(isvisible bool)

SetVisible sets the current visibility of the cursor.

func SetX

func SetX(x float32)

SetX sets the current X position of the mouse.

func SetY

func SetY(y float32)

SetY sets the current Y position of the mouse.

Types

type Button

type Button uint32

Button refers to a physical mouse button, BUTTON_LEFT, BUTTON_RIGHT, ect.

const (
	LeftButton   Button = sdl.BUTTON_LEFT
	MiddleButton Button = sdl.BUTTON_MIDDLE
	RightButton  Button = sdl.BUTTON_RIGHT
	X1Button     Button = sdl.BUTTON_X1
	X2Button     Button = sdl.BUTTON_X2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL