joystick
a polled API to read the state of an attached joystick
About joystick
joystick
Go Joystick API
Package joystick implements a Polled API to read the state of an attached joystick. Windows, Linux & OSX are supported. Package requires no external dependencies to be installed.
Mac OSX code developed by: https://github.com/ledyba
Installation:
$ go get github.com/0xcafed00d/joystick/...
Sample Program
$ go install github.com/0xcafed00d/joystick/joysticktest
$ joysticktest 0
Displays the state of the specified joystick
Example:
import "github.com/0xcafed00d/joystick"
js, err := joystick.Open(jsid)
if err != nil {
panic(err)
}
fmt.Printf("Joystick Name: %s", js.Name())
fmt.Printf(" Axis Count: %d", js.AxisCount())
fmt.Printf(" Button Count: %d", js.ButtonCount())
state, err := joystick.Read()
if err != nil {
panic(err)
}
fmt.Printf("Axis Data: %v", state.AxisData)
js.Close()
Frequently Asked Questions
What is joystick?
joystick is a Hardware library for the Go programming language. a polled API to read the state of an attached joystick
How do I install joystick?
Install joystick with the Go module system using `go get 0xcafed00d/joystick`. Check the repository for the current installation instructions.
What category does joystick belong to?
joystick is listed under Hardware, specifically Hardware.