js

package
v0.0.0-...-0ae44e5 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package js is a simple API to interact with the joystick (on Linux).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	// Number is the number given to the axis/button.
	Number int
	// Name is the name of the axis/button.
	Name string
	// Name is the last known value of the axis/button in the range of [-1..1].
	Value float64
	// Name is the initial value of the axis/button in the range of [-1..1]. (NOT IMPLEMENTED YET)
	InitialValue float64
}

Element represents a single axis or button.

type JoystickEvent

type JoystickEvent struct {
	Timestamp time.Time
	Value     float64
	Element   *Element
}

JoystickEvent is a single joystick event.

type Js

type Js struct {
	DevicePath string
	Name       string
	NumAxes    int
	NumButtons int
	Axes       []Element
	Buttons    []Element
	// contains filtered or unexported fields
}

Js represents a joystick input device.

func NewJs

func NewJs(device string) (*Js, error)

NewJs creates a new Js instance with the given device file.

func (*Js) Close

func (js *Js) Close() error

func (*Js) Read

func (js *Js) Read() (JoystickEvent, error)

Jump to

Keyboard shortcuts

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