Documentation
¶
Index ¶
Constants ¶
View Source
const ( ErrNotifierNotInitialized = "notifier not initialized" ErrOsNotSupported = "os is not supported (yet)" ErrJoystickAlreadySubscribed = "joystick is already subscribed" ErrJoystickAlreadyUnsubscribed = "joystick is already unsubscribed" ErrJoystickNotFound = "joystick with id '%s' was not found" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bus ¶
type Bus interface {
// NewEventChannel creates a new event channel that filters the events based on the provided filter functions.
NewEventChannel(filters ...FilterFunc) (dest *EventChannel)
// Gamepads returns a list of all the available gamepads connected to the system.
Gamepads() (gamepads []Gamepad)
// Subscribe subscribes to the joystick events for a specific gamepad ID.
Subscribe(id string) (err error)
// Unsubscribe unsubscribes from the joystick events for a specific gamepad ID.
Unsubscribe(id string) (err error)
// Close stops the bus and closes all the event channels.
Close()
}
Bus is the main interface for interacting with the joystick events.
type ControlEvent ¶
type ControlEvent struct {
Timestamp uint32
Type ControlType
Index int
Value int16
}
ControlEvent represents a single control event, such as a button press or axis movement.
type ControlType ¶
type ControlType uint8
ControlType represents the different types of control events.
const ( Button ControlType = 0x01 Axes ControlType = 0x02 InitialState ControlType = 0x08 )
type EventChannel ¶
type EventChannel struct {
Ctx context.Context
Ch chan *Event
ErrCh chan error
CancelFunc context.CancelFunc
}
EventChannel represents an event channel that can be used to receive events from gamepads.
type EventType ¶
type EventType uint8
EventType represents the different types of events that can occur.
type FilterFunc ¶
FilterFunc is a function type used to filter events before they are sent to the event channel.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.