input

package
v0.14.6-altui Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: GPL-3.0 Imports: 5 Imported by: 6

Documentation

Overview

Package input exposes the two input callbacks Poll and State needed by the libretro implementation. It uses GLFW to access keyboard and joypad, and takes care of binding and auto configuring joypads.

Index

Constants

View Source
const (
	// ActionMenuToggle toggles the menu UI
	ActionMenuToggle uint32 = libretro.DeviceIDJoypadR3 + 1
	// ActionFullscreenToggle switches between fullscreen and windowed mode
	ActionFullscreenToggle uint32 = libretro.DeviceIDJoypadR3 + 2
	// ActionShouldClose will cause the program to shutdown
	ActionShouldClose uint32 = libretro.DeviceIDJoypadR3 + 3
	// ActionFastForwardToggle will run the core as fast as possible
	ActionFastForwardToggle uint32 = libretro.DeviceIDJoypadR3 + 4
	// ActionLast is used for iterating
	ActionLast uint32 = libretro.DeviceIDJoypadR3 + 5
)

Hot keys

View Source
const MaxPlayers = 5

MaxPlayers is the maximum number of players to poll input for

Variables

View Source
var (
	NewState States // input state for the current frame
	OldState States // input state for the previous frame
	Released States // keys just released during this frame
	Pressed  States // keys just pressed during this frame

	NewAnalogState AnalogStates // analog input state for the current frame
)

Input state for all the players

Functions

func HasBinding added in v0.10.3

func HasBinding(joy glfw.Joystick) bool

HasBinding returns true if the joystick has an autoconfig binding

func Init

func Init(v *video.Video)

Init initializes the input package

func Poll

func Poll()

Poll calculates the input state. It is meant to be called for each frame.

func State

func State(port uint, device uint32, index uint, id uint) int16

State is a callback passed to core.SetInputState It returns 1 if the button corresponding to the parameters is pressed

Types

type AnalogStates added in v0.14.0

type AnalogStates [MaxPlayers][2][2]int16

AnalogStates can store the state of analog inputs for all players

type States added in v0.12.3

type States [MaxPlayers][ActionLast]int16

States can store the state of inputs for all players

Jump to

Keyboard shortcuts

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