padstd

package
v1.17.13 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package padstd helps the backends whose pads already report the standard layout (XInput on Windows, the standard mapping of a browser): such a pad is a PadInfo with Standard set, and its raw buttons and axes are the Button and Axis of gamepaddb in the order of the layout. A backend that polls fills a Snapshot each time and a Tracker turns the changes into PadEvents (SPEC §28.2). It is plain Go with no OS tag.

Flutter: no counterpart

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flip

func Flip(v int16) int16

Flip turns an axis around: the vertical axes of XInput are positive upwards and those of the layout downwards.

Flutter: no counterpart

func Signed

func Signed(v float64) int16

Signed scales a number from −1 to 1, as the browser gives a stick, to the range of an axis, clamping it.

Flutter: no counterpart

func Trigger8

func Trigger8(v uint8) int16

Trigger8 scales a trigger of 8 bits (0 to 255) to the range of a trigger axis (0 to 32767).

Flutter: no counterpart

func Unit

func Unit(v float64) int16

Unit scales a number from 0 to 1, as the browser gives the value of a trigger, to the range of a trigger axis, clamping it.

Flutter: no counterpart

Types

type Snapshot

type Snapshot struct {
	Buttons [gamepaddb.ButtonCount]bool
	Axes    [gamepaddb.AxisCount]int16
}

Snapshot is the state of a pad of the standard layout: which buttons are down, and the axes (the sticks from −32768 to 32767 with down and right positive, the triggers from 0 to 32767).

Flutter: no counterpart

type Tracker

type Tracker struct {
	// contains filtered or unexported fields
}

Tracker turns the snapshots of one pad into the events of what changed.

Flutter: no counterpart

func NewTracker

func NewTracker(id platform.PadID) *Tracker

NewTracker makes the tracker of a pad that has just been connected: the state it starts from is everything up and every axis at rest.

Flutter: no counterpart

func (*Tracker) Update

func (t *Tracker) Update(now time.Duration, s *Snapshot, out []platform.PadEvent) []platform.PadEvent

Update appends to out the events of what differs between s and the snapshot before it, buttons first and then axes, and remembers s. now is the time the state was read.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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