input

package
v1.0.89 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoInput InputMap = 0

	// Allocated input bits.
	DOSKeyboardWithEscape    InputMap = 1
	NESKeyboardWithEscape    InputMap = 2
	FPSKeyboardWithEscape    InputMap = 4
	ViKeyboardWithEscape     InputMap = 8
	Gamepad                  InputMap = 16
	DOSKeyboardWithBackspace InputMap = 32
	NESKeyboardWithBackspace InputMap = 64
	FPSKeyboardWithBackspace InputMap = 128
	ViKeyboardWithBackspace  InputMap = 256

	// Computed helpers values.
	AnyKeyboardWithEscape    = DOSKeyboardWithEscape | NESKeyboardWithEscape | FPSKeyboardWithEscape | ViKeyboardWithEscape
	AnyKeyboardWithBackspace = DOSKeyboardWithBackspace | NESKeyboardWithBackspace | FPSKeyboardWithBackspace | ViKeyboardWithBackspace
	DOSKeyboard              = DOSKeyboardWithEscape | DOSKeyboardWithBackspace
	NESKeyboard              = NESKeyboardWithEscape | NESKeyboardWithBackspace
	FPSKeyboard              = FPSKeyboardWithEscape | FPSKeyboardWithBackspace
	ViKeyboard               = ViKeyboardWithEscape | ViKeyboardWithBackspace
	AnyKeyboard              = AnyKeyboardWithEscape | AnyKeyboardWithBackspace
	AnyInput                 = AnyKeyboard | Gamepad
)

Variables

View Source
var (
	Left       = (&impulse{Name: "Left", keys: leftKeys, padControls: leftPad}).register()
	Right      = (&impulse{Name: "Right", keys: rightKeys, padControls: rightPad}).register()
	Up         = (&impulse{Name: "Up", keys: upKeys, padControls: upPad}).register()
	Down       = (&impulse{Name: "Down", keys: downKeys, padControls: downPad}).register()
	Jump       = (&impulse{Name: "Jump", keys: jumpKeys, padControls: jumpPad}).register()
	Action     = (&impulse{Name: "Action", keys: actionKeys, padControls: actionPad}).register()
	Exit       = (&impulse{Name: "Exit", keys: exitKeys, padControls: exitPad}).register()
	Fullscreen = (&impulse{Name: "Fullscreen", keys: fullscreenKeys}).register()
)

Functions

func EasterEggJustHit

func EasterEggJustHit() bool

func Init

func Init() error

func LoadFromDemo

func LoadFromDemo(state *DemoState)

func Update

func Update()

Types

type DemoState

type DemoState struct {
	InputMap         InputMap      `json:",omitempty"`
	Left             *ImpulseState `json:",omitempty"`
	Right            *ImpulseState `json:",omitempty"`
	Up               *ImpulseState `json:",omitempty"`
	Down             *ImpulseState `json:",omitempty"`
	Jump             *ImpulseState `json:",omitempty"`
	Action           *ImpulseState `json:",omitempty"`
	Exit             *ImpulseState `json:",omitempty"`
	EasterEggJustHit bool          `json:",omitempty"`
}

func SaveToDemo

func SaveToDemo() *DemoState

type ExitButtonID added in v1.0.59

type ExitButtonID int
const (
	Escape ExitButtonID = iota
	Backspace
	Start
)

func ExitButton added in v1.0.59

func ExitButton() ExitButtonID

type ImpulseState

type ImpulseState struct {
	Held    bool `json:",omitempty"`
	JustHit bool `json:",omitempty"`
}

func (*ImpulseState) Empty

func (i *ImpulseState) Empty() bool

func (*ImpulseState) OrEmpty

func (i *ImpulseState) OrEmpty() ImpulseState

func (*ImpulseState) UnlessEmpty

func (i *ImpulseState) UnlessEmpty() *ImpulseState

type InputMap

type InputMap int

func Map

func Map() InputMap

func (InputMap) ContainsAny

func (i InputMap) ContainsAny(o InputMap) bool

Jump to

Keyboard shortcuts

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