input

package
v0.0.0-...-b13d3a1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2018 License: Zlib Imports: 3 Imported by: 4

Documentation

Overview

Package input provides a wrapper to handle user input events (keyboard and mouse for now).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager hold data of events

func (*Manager) Button

func (i *Manager) Button() sdl.KeyboardEvent

Button returns the first button pressed. Useful to use in multiple systems

func (*Manager) HandleEvents

func (i *Manager) HandleEvents() bool

HandleEvents handle the events such as key pressed and mouse movements.

func (*Manager) PopEvent

func (i *Manager) PopEvent()

PopEvent removes the first element added. Usually pop returns the element popped, but this one doesn't. I couldn't come up with a good name.

type MouseEvent

type MouseEvent struct {
	Pos    *sdl.Point
	Button uint8 // BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, BUTTON_X1, BUTTON_X2
	State  uint8 // PRESSED, RELEASE
}

MouseEvent has the position and button pressed by the mouse

func (*MouseEvent) ClearMouseEvent

func (m *MouseEvent) ClearMouseEvent()

ClearMouseEvent sets the id of the button to 0 which no mouse button is assigned to

Jump to

Keyboard shortcuts

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