mouse

package
v0.0.0-...-fab1f19 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2020 License: Apache-2.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Height uint32 = 768
	Width  uint32 = 1024
)

Screen height and width constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	IsPressed bool
}

Button implements Clicker interface methods and contains a button pressed state.

func (*Button) Down

func (btn *Button) Down()

Down simulates the button pressed and changed button pressed state to true.

func (*Button) State

func (btn *Button) State() bool

State return button pressed state.

func (*Button) Up

func (btn *Button) Up()

Up simulates the button pushed and changed button pressed state to false.

type Clicker

type Clicker interface {
	Up()
	Down()
	State() bool
}

Clicker is the interface which contains required methods to use as a button.

The structure that implement this interface must store the boolean state of the button click.

type Mouse

type Mouse struct {
	// contains filtered or unexported fields
}

Mouse stores mouse states and settings.

func NewMouse

func NewMouse(screen Screen, lButton Clicker, rButton Clicker, wheel Scroller) *Mouse

NewMouse create a new mouse.

func (*Mouse) Info

func (m *Mouse) Info()

Info displays mouse states and settings.

func (*Mouse) LeftButtonDown

func (m *Mouse) LeftButtonDown()

LeftButtonDown simulates the left button pressed.

func (*Mouse) LeftButtonUp

func (m *Mouse) LeftButtonUp()

LeftButtonUp simulates the left button released.

func (*Mouse) Move

func (m *Mouse) Move(x, y uint32, screen Screen)

Move moving the mouse cursor to x, y coordinates.

func (*Mouse) Reset

func (m *Mouse) Reset(screen Screen)

Reset returns default settings and mouse states.

func (*Mouse) RightButtonDown

func (m *Mouse) RightButtonDown()

RightButtonDown simulates the right button pressed.

func (*Mouse) RightButtonUp

func (m *Mouse) RightButtonUp()

RightButtonUp simulates the right button released.

func (*Mouse) ScrollDown

func (m *Mouse) ScrollDown()

ScrollDown simulates mouse scroll down.

func (*Mouse) ScrollUp

func (m *Mouse) ScrollUp()

ScrollUp simulates mouse scroll up.

func (*Mouse) Sensitivity

func (m *Mouse) Sensitivity(val uint8)

Sensitivity sets a new value for mouse sensitivity.

type Screen

type Screen struct {
	// contains filtered or unexported fields
}

Screen stores screen borders so that the mouse cursor does not run behind them

func NewScreen

func NewScreen(width, height uint32) *Screen

NewScreen create new screen

type Scroller

type Scroller interface {
	ScrollUp()
	ScrollDown()
	State() uint8
}

Scroller is the interface which contains required methods to use as a mouse wheel.

The structure that implement this interface must store the mouse wheel scroll value.

type Wheel

type Wheel struct {
	ScrollValue uint8
}

Wheel implements Scroller interface methods and contains a scroll value.

func NewWheel

func NewWheel() *Wheel

NewWheel returns new Wheel structure object with a scroll value by default.

func (*Wheel) ScrollDown

func (w *Wheel) ScrollDown()

ScrollDown simulates mouse wheel scroll down.

func (*Wheel) ScrollUp

func (w *Wheel) ScrollUp()

ScrollUp simulates mouse wheel scroll up.

func (*Wheel) State

func (w *Wheel) State() uint8

State return mouse wheel scroll value

Jump to

Keyboard shortcuts

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