input

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorQuit error = errors.New("input.Event: normal termination")

error represents quit signal.

Functions

This section is empty.

Types

type ControlType

type ControlType int8
const (
	// these are used with EventControl, which controlls
	// scene flow. Typically, EventControl is sent when pushed special
	// key such as Ctrl-Any, Shift-Any, F1, F2, ...,  ESC and etc.
	ControlNone ControlType = iota // dummy

	// starting skipping wait. skip means game flow is running
	// without any waits.
	ControlStartSkippingWait

	// stopping skipping wait. skip means game flow is running
	// without any waits.
	ControlStopSkippingWait

	// stop current running macro.
	ControlInterruptMacro
)

type Event

type Event struct {
	Type    EventType
	Control ControlType
	Command string
}

Event has information of inputed command and error etc..

func NewEventCommand

func NewEventCommand(cmd string) Event

make new InputEvent type EventCommand. cmd = "" means emitting command nothing.

func NewEventControl

func NewEventControl(ctrl ControlType) Event

make new InputEvent type EventControl.

func NewEventQuit

func NewEventQuit() Event

make quit event. it is intended to send quit siganl.

func NewEventRawInput

func NewEventRawInput(r rune) Event

make new input event type EventRawInput. it is intended for user key press, so accepts only one character or rune.

type EventType

type EventType int8
const (
	EventNone     EventType = iota // dummy event
	EventCommand                   //	emits command by user confirming.
	EventRawInput                  // raw input such as user key press.
	EventControl                   // controll signal for input state..
	EventQuit                      // terminate signal
)

Jump to

Keyboard shortcuts

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