keybind

package
v0.0.0-...-79996cc Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package keybind centralizes the global hotkey bindings.

Whenever the app would need to query a hotkey like "F3" or "Ctrl-Z" is held down, it should use a method in this file. It can be expanded later to allow user customizable bindings or something.

NOTE: arrow key and gameplay controls not yet ported to here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearLeftClick

func ClearLeftClick(ev *event.State)

ClearLeftClick sets the primary mouse button state to false.

func CloseAllWindows

func CloseAllWindows(ev *event.State) bool

CloseAllWindows (Shift+Backspace)

func CloseTopmostWindow

func CloseTopmostWindow(ev *event.State) bool

CloseTopmostWindow (Backspace)

func DebugCollision

func DebugCollision(ev *event.State) bool

DebugCollision (F4) can be checked one time.

func DebugOverlay

func DebugOverlay(ev *event.State) bool

DebugOverlay (F3) can be checked one time.

func DoodadDropper

func DoodadDropper(ev *event.State) bool

DoodadDropper (D) opens the doodad dropper in the editor.

func Down

func Down(ev *event.State) bool

Down arrow.

func EllipseTool

func EllipseTool(ev *event.State) bool

EllipseTool (C) selects this tool in the editor.

func Enter

func Enter(ev *event.State) bool

Enter key.

func EraserTool

func EraserTool(ev *event.State) bool

EraserTool (X) selects this tool in the editor.

func GotoEdit

func GotoEdit(ev *event.State) bool

GotoEdit (E) opens the current played level in Edit Mode, if the player has come from the editor originally.

func GotoPlay

func GotoPlay(ev *event.State) bool

GotoPlay (P) play tests the current level in the editor.

func Help

func Help(ev *event.State) bool

Help (F1) can be checked one time.

func Left

func Left(ev *event.State) bool

Left arrow.

func LeftClick

func LeftClick(ev *event.State) bool

LeftClick of the primary mouse button.

func LineTool

func LineTool(ev *event.State) bool

LineTool (L) selects the Line Tool in the editor.

func MiddleClick

func MiddleClick(ev *event.State) bool

MiddleClick of the mouse for panning the level.

func NewLevel

func NewLevel(ev *event.State) bool

New Level (Ctrl-N)

func NewViewport

func NewViewport(ev *event.State) bool

NewViewport (V)

func Open

func Open(ev *event.State) bool

Open (Ctrl-O)

func Origin

func Origin(ev *event.State) bool

Origin (0) -- scrolls the canvas back to 0,0 in Editor Mode.

func PencilTool

func PencilTool(ev *event.State) bool

PencilTool (F) selects the freehand pencil tool in the editor. GotoPlay (P) play tests the current level in the editor.

func RectTool

func RectTool(ev *event.State) bool

RectTool (R) selects the rectangle in the editor.

func Redo

func Redo(ev *event.State) bool

Redo (Ctrl-Y)

func Right(ev *event.State) bool

Right arrow.

func Save

func Save(ev *event.State) bool

Save (Ctrl-S)

func SaveAs

func SaveAs(ev *event.State) bool

SaveAs (Shift-Ctrl-S)

func ShellKey

func ShellKey(ev *event.State) bool

ShellKey (`) opens the developer console.

func Shift

func Shift(ev *event.State) bool

Shift key.

func Shutdown

func Shutdown(ev *event.State) bool

Shutdown (Escape) signals the game to start closing down.

func Undo

func Undo(ev *event.State) bool

Undo (Ctrl-Z)

func Up

func Up(ev *event.State) bool

Up arrow.

func Use

func Use(ev *event.State) bool

"Use" button.

func ZoomIn

func ZoomIn(ev *event.State) bool

ZoomIn (+)

func ZoomOut

func ZoomOut(ev *event.State) bool

ZoomOut (-)

func ZoomReset

func ZoomReset(ev *event.State) bool

ZoomReset (1)

Types

type State

type State struct {
	State          *event.State
	Shutdown       bool // Escape key
	Help           bool // F1
	DebugOverlay   bool // F3
	DebugCollision bool // F4
	Undo           bool // Ctrl-Z
	Redo           bool // Ctrl-Y
	NewLevel       bool // Ctrl-N
	Save           bool // Ctrl-S
	SaveAs         bool // Shift-Ctrl-S
	Open           bool // Ctrl-O
	ZoomIn         bool // +
	ZoomOut        bool // -
	ZoomReset      bool // 1
	Origin         bool // 0
	GotoPlay       bool // p
	GotoEdit       bool // e
	PencilTool     bool
	LineTool       bool
	RectTool       bool
	EllipseTool    bool
	EraserTool     bool
	DoodadDropper  bool
	ShellKey       bool
	Enter          bool
	Left           bool
	Right          bool
	Up             bool
	Down           bool
	Use            bool
}

State returns a version of event.State which is domain specific to what the game actually cares about.

func FromEvent

func FromEvent(ev *event.State) State

FromEvent converts a render.Event readout of the current keys being pressed but formats them in the way the game uses them. For example, WASD and arrow keys both move the player and the game only cares which direction.

Jump to

Keyboard shortcuts

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