Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoSuchField is returned in the event that no field is // available for the given fieldID. ErrNoSuchField = errors.New("no field with that ID exists") )
Functions ¶
This section is empty.
Types ¶
type JSController ¶
type JSController struct {
// contains filtered or unexported fields
}
JSController handles the action of actually fetching data from the joystick and making it available to the rest of the system.
func NewJSController ¶
func NewJSController(opts ...Option) JSController
NewJSController sets up the joystick controller.
func (*JSController) BindController ¶
func (j *JSController) BindController(id int) error
BindController attaches to a particular controller ID on the host system.
func (*JSController) GetState ¶
func (j *JSController) GetState() (*Values, error)
GetState polls the joystick and updates the values available to the controller.
func (*JSController) Rebind ¶
func (j *JSController) Rebind() error
Rebind attempts to rebind the controller this instance was initialized for.
type Option ¶
type Option func(jsc *JSController)
Option is used to enable variadic option passing to the joystick controller.
func WithLogger ¶
func WithLogger(l hclog.Logger) Option
WithLogger sets the logging instance for the gamepad controller.
type Values ¶
type Values struct { AxisLX int AxisLY int AxisRX int AxisRY int AxisDX int AxisDY int ButtonBack bool ButtonStart bool ButtonLeftStick bool ButtonRightStick bool ButtonX bool ButtonY bool ButtonA bool ButtonB bool ButtonLShoulder bool ButtonRShoulder bool ButtonLT bool ButtonRT bool }
Values abstracts over the joystick to the given values that are returned by a gamepad.
Click to show internal directories.
Click to hide internal directories.