gamepad

package
v0.0.0-...-c98f1fc Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2018 License: Unlicense Imports: 3 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	ControllerCount    = ID(4)
	TriggerThreshold   = 30
	LeftThumbDeadZone  = 7849
	RightThumbDeadZone = 8689
)
View Source
const (
	DPadUp    Button = 0x0001
	DPadDown         = 0x0002
	DPadLeft         = 0x0004
	DPadRight        = 0x0008

	Start Button = 0x0010
	Back         = 0x0020

	LeftThumb  Button = 0x0040
	RightThumb        = 0x0080

	LeftShoulder  Button = 0x0100
	RightShoulder        = 0x0200

	ButtonA Button = 0x1000
	ButtonB        = 0x2000
	ButtonX        = 0x4000
	ButtonY        = 0x8000
)

Variables

This section is empty.

Functions

func Get

func Get(id ID, state *State) error

Get retrieves the latest state of the controller.

func Vibrate

func Vibrate(id ID, vibration *Vibration) error

Types

type All

func (*All) Update

func (all *All) Update() (firsterr error)

type Button

type Button uint16

type ID

type ID byte

type State

type State struct {
	ID        ID
	Connected bool

	Packet uint32
	Raw    struct {
		Buttons      Button
		LeftTrigger  uint8
		RightTrigger uint8
		ThumbLX      int16
		ThumbLY      int16
		ThumbRX      int16
		ThumbRY      int16
	}
}

func (*State) Pressed

func (state *State) Pressed(button Button) bool

func (*State) RectDPad

func (state *State) RectDPad() (thumb Thumb)

func (*State) RectLeft

func (state *State) RectLeft() Thumb

func (*State) RectRight

func (state *State) RectRight() Thumb

func (*State) RoundDPad

func (state *State) RoundDPad() (thumb Thumb)

func (*State) RoundLeft

func (state *State) RoundLeft() Thumb

func (*State) RoundRight

func (state *State) RoundRight() Thumb

func (*State) Update

func (state *State) Update() error

func (*State) Vibrate

func (state *State) Vibrate(left, right uint16)

type Thumb

type Thumb struct{ X, Y, Magnitude float32 }

type Vibration

type Vibration struct {
	LeftMotor  uint16
	RightMotor uint16
}

Jump to

Keyboard shortcuts

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