gamepadmap

package
v2.18.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package gamepadmap holds the ZapScript gamepad button names and the raw evdev button codes they resolve to. The codes are the canonical namespace the input engine works in; backends translate them to whatever their own API expects. It is split out of the uinput-dependent parent package so platforms without uinput can share the same button names.

Index

Constants

View Source
const (
	ButtonSouth        = 0x130 // BTN_SOUTH
	ButtonEast         = 0x131 // BTN_EAST
	ButtonNorth        = 0x133 // BTN_NORTH
	ButtonWest         = 0x134 // BTN_WEST
	ButtonBumperLeft   = 0x136 // BTN_TL
	ButtonBumperRight  = 0x137 // BTN_TR
	ButtonTriggerLeft  = 0x138 // BTN_TL2
	ButtonTriggerRight = 0x139 // BTN_TR2
	ButtonSelect       = 0x13a // BTN_SELECT
	ButtonStart        = 0x13b // BTN_START
	ButtonMode         = 0x13c // BTN_MODE
	ButtonDpadUp       = 0x220 // BTN_DPAD_UP
	ButtonDpadDown     = 0x221 // BTN_DPAD_DOWN
	ButtonDpadLeft     = 0x222 // BTN_DPAD_LEFT
	ButtonDpadRight    = 0x223 // BTN_DPAD_RIGHT
)

Raw evdev BTN_* codes. These match the uinput package's Button* constants, but are declared here so non-Linux builds can use the same namespace.

Variables

View Source
var GamepadMap = map[string]int{
	"^":        ButtonDpadUp,
	"{up}":     ButtonDpadUp,
	"v":        ButtonDpadDown,
	"V":        ButtonDpadDown,
	"{down}":   ButtonDpadDown,
	"<":        ButtonDpadLeft,
	"{left}":   ButtonDpadLeft,
	">":        ButtonDpadRight,
	"{right}":  ButtonDpadRight,
	"A":        ButtonEast,
	"a":        ButtonEast,
	"{east}":   ButtonEast,
	"B":        ButtonSouth,
	"b":        ButtonSouth,
	"{south}":  ButtonSouth,
	"X":        ButtonNorth,
	"x":        ButtonNorth,
	"{north}":  ButtonNorth,
	"Y":        ButtonWest,
	"y":        ButtonWest,
	"{west}":   ButtonWest,
	"{start}":  ButtonStart,
	"{select}": ButtonSelect,
	"{menu}":   ButtonMode,
	"L":        ButtonBumperLeft,
	"l":        ButtonBumperLeft,
	"{l1}":     ButtonBumperLeft,
	"R":        ButtonBumperRight,
	"r":        ButtonBumperRight,
	"{r1}":     ButtonBumperRight,
	"{l2}":     ButtonTriggerLeft,
	"{r2}":     ButtonTriggerRight,
}

Functions

func ToGamepadCode

func ToGamepadCode(name string) (int, bool)

ToGamepadCode converts a single ZapScript button symbol to an evdev code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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