Documentation ¶
Overview ¶
Package gamepad implements access to the system's gamepad or joystick API.
This package currently supports windows, linux, and js/wasm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Gamepad ¶
type Gamepad struct {
// contains filtered or unexported fields
}
func List ¶
func List() []*Gamepad
List returns the currently known gamepads.
The returned slice is valid until Update is called.
func (*Gamepad) Axis ¶
Axis returns the current state of the given axis on the gamepad.
If index is not in [0, NumAxis), this method returns NaN.
func (*Gamepad) Button ¶
Button returns the current state of the given button on the gamepad.
If index is not in [0, NumButton), this method returns NaN, false.
If the platform does not support variable button presses, the value of the float is either 0 or 1.
func (*Gamepad) Name ¶
Name returns an identifier for this gamepad. It does not change, although on Windows, multiple gamepads may have the same name.