input

package
v1.3.538 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 17 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: touchRectLeft}).register()
	Right      = (&impulse{Name: "Right", keys: rightKeys, padControls: rightPad, touchRect: touchRectRight}).register()
	Up         = (&impulse{Name: "Up", keys: upKeys, padControls: upPad, touchRect: touchRectUp}).register()
	Down       = (&impulse{Name: "Down", keys: downKeys, padControls: downPad, touchRect: touchRectDown}).register()
	Jump       = (&impulse{Name: "Jump", keys: jumpKeys, padControls: jumpPad, touchRect: touchRectJump}).register()
	Action     = (&impulse{Name: "Action", keys: actionKeys, padControls: actionPad, touchRect: touchRectAction}).register()
	Exit       = (&impulse{Name: "Exit", keys: exitKeys, padControls: exitPad, mouseControl: true, touchRect: touchRectExit}).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 DrawEditor added in v1.3.511

func DrawEditor(screen *ebiten.Image)

func EasterEggJustHit

func EasterEggJustHit() bool

func ExitPressed added in v1.2.265

func ExitPressed()

func HaveTouch added in v1.3.43

func HaveTouch() 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 SetActionButtonAvailable added in v1.3.511

func SetActionButtonAvailable(avail bool)

func SetMode added in v1.2.399

func SetMode(mode Mode)

func TouchResetEditor added in v1.3.43

func TouchResetEditor()

func Update

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

Types

type ActionButtonID added in v1.3.263

type ActionButtonID int
const (
	BX ActionButtonID = iota
	Elsewhere
	B
	CtrlShift
	Z
	ShiftETab
	EnterShift
)

func ActionButton added in v1.3.263

func ActionButton() ActionButtonID

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 (
	Start ExitButtonID = iota
	Back
	Escape
	Backspace
)

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 (InputMap) ContainsAny

func (i InputMap) ContainsAny(o InputMap) bool

type Mode added in v1.2.399

type Mode int
const (
	PlayingMode Mode = iota
	EndingMode
	MenuMode
	TouchEditMode
)

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