gamepaddb

package
v2.3.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HatUp    = 1
	HatRight = 2
	HatDown  = 4
	HatLeft  = 8
)

Variables

This section is empty.

Functions

func AxisValue

func AxisValue(id string, axis StandardAxis, state GamepadState) float64

func ButtonValue

func ButtonValue(id string, button StandardButton, state GamepadState) float64

func HasStandardLayoutMapping

func HasStandardLayoutMapping(id string) bool

func IsButtonPressed

func IsButtonPressed(id string, button StandardButton, state GamepadState) bool

func Name added in v2.3.0

func Name(id string) string

func Update

func Update(mappingData []byte) (bool, error)

Update adds new gamepad mappings. The string must be in the format of SDL_GameControllerDB.

Update works atomically. If an error happens, nothing is updated.

Types

type GamepadState

type GamepadState interface {
	Axis(index int) float64
	Button(index int) bool
	Hat(index int) int
}

type StandardAxis added in v2.3.0

type StandardAxis int
const (
	StandardAxisLeftStickHorizontal StandardAxis = iota
	StandardAxisLeftStickVertical
	StandardAxisRightStickHorizontal
	StandardAxisRightStickVertical

	StandardAxisMax = StandardAxisRightStickVertical
)

https://www.w3.org/TR/gamepad/#remapping

type StandardButton added in v2.3.0

type StandardButton int
const (
	StandardButtonRightBottom StandardButton = iota
	StandardButtonRightRight
	StandardButtonRightLeft
	StandardButtonRightTop
	StandardButtonFrontTopLeft
	StandardButtonFrontTopRight
	StandardButtonFrontBottomLeft
	StandardButtonFrontBottomRight
	StandardButtonCenterLeft
	StandardButtonCenterRight
	StandardButtonLeftStick
	StandardButtonRightStick
	StandardButtonLeftTop
	StandardButtonLeftBottom
	StandardButtonLeftLeft
	StandardButtonLeftRight
	StandardButtonCenterCenter

	StandardButtonMax = StandardButtonCenterCenter
)

https://www.w3.org/TR/gamepad/#remapping

Jump to

Keyboard shortcuts

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