input

package
v1.1.234 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 14 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
	Touchscreen              InputMap = 512

	// 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 | Touchscreen
)

Variables

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

Functions

func CancelHover added in v1.1.112

func CancelHover()

func ClickPos added in v1.1.112

func ClickPos() (m.Pos, bool)

func Draw added in v1.1.112

func Draw(screen *ebiten.Image)

func EasterEggJustHit

func EasterEggJustHit() bool

func HoverPos added in v1.1.112

func HoverPos() (m.Pos, bool)

func Init

func Init() error

func KonamiCodeJustHit added in v1.1.31

func KonamiCodeJustHit() bool

func LoadFromDemo

func LoadFromDemo(state *DemoState)

func SetWantClicks added in v1.1.112

func SetWantClicks(want bool)

func Update

func Update(screenWidth, screenHeight, gameWidth, gameHeight int, crtK1, crtK2 float64)

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"`
	HoverPos          *m.Pos        `json:",omitempty"`
	ClickPos          *m.Pos        `json:",omitempty"`
	EasterEggJustHit  bool          `json:",omitempty"`
	KonamiCodeJustHit bool          `json:",omitempty"`
}

func SaveToDemo

func SaveToDemo() *DemoState

type ExitButtonID added in v1.0.59

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

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

type MouseStatus added in v1.1.112

type MouseStatus int
const (
	NoMouse MouseStatus = iota
	HoveringMouse
	ClickingMouse
)

func Mouse added in v1.1.112

func Mouse() (m.Pos, MouseStatus)

Jump to

Keyboard shortcuts

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