keys

package
v0.0.0-...-124f97e Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Press   Action = Action(glfw.Press)
	Release        = Action(glfw.Release)
	Repeat         = Action(glfw.Repeat)
	Char           = Action(3)
)
View Source
const (
	A Code = 65
	B Code = 66
	C Code = 67
	D Code = 68
	E Code = 69
	F Code = 70
	G Code = 71
	H Code = 72
	I Code = 73
	J Code = 74
	K Code = 75
	L Code = 76
	M Code = 77
	N Code = 78
	O Code = 79
	P Code = 80
	Q Code = 81
	R Code = 82
	S Code = 83
	T Code = 84
	U Code = 85
	V Code = 86
	W Code = 87
	X Code = 88
	Y Code = 89
	Z Code = 90

	Key0 = Code(glfw.Key0)
	Key1 = Code(glfw.Key1)
	Key2 = Code(glfw.Key2)
	Key3 = Code(glfw.Key3)
	Key4 = Code(glfw.Key4)
	Key5 = Code(glfw.Key5)
	Key6 = Code(glfw.Key6)
	Key7 = Code(glfw.Key7)
	Key8 = Code(glfw.Key8)
	Key9 = Code(glfw.Key9)

	Enter        = Code(glfw.KeyEnter)
	Escape       = Code(glfw.KeyEscape)
	Backspace    = Code(glfw.KeyBackspace)
	Delete       = Code(glfw.KeyDelete)
	Space        = Code(glfw.KeySpace)
	LeftShift    = Code(glfw.KeyLeftShift)
	RightShift   = Code(glfw.KeyRightShift)
	LeftControl  = Code(glfw.KeyLeftControl)
	RightControl = Code(glfw.KeyRightControl)
	LeftAlt      = Code(glfw.KeyLeftAlt)
	RightAlt     = Code(glfw.KeyRightAlt)
	LeftSuper    = Code(glfw.KeyLeftSuper)
	RightSuper   = Code(glfw.KeyRightSuper)
	LeftArrow    = Code(glfw.KeyLeft)
	RightArrow   = Code(glfw.KeyRight)
	UpArrow      = Code(glfw.KeyUp)
	DownArrow    = Code(glfw.KeyDown)
	NumpadEnter  = Code(glfw.KeyKPEnter)
)

GLFW Keycodes

View Source
const (
	NoMod = Modifier(0)
	Shift = Modifier(glfw.ModShift)
	Ctrl  = Modifier(glfw.ModControl)
	Alt   = Modifier(glfw.ModAlt)
	Super = Modifier(glfw.ModSuper)
)

Variables

This section is empty.

Functions

func CharCallbackWrapper

func CharCallbackWrapper(handler Handler) glfw.CharCallback

func Focus

func Focus(handler FocusHandler)

func KeyCallbackWrapper

func KeyCallbackWrapper(handler Handler) glfw.KeyCallback

func Pressed

func Pressed(ev Event, code Code) bool

func PressedMods

func PressedMods(ev Event, code Code, mods Modifier) bool

func Released

func Released(ev Event, code Code) bool

func ReleasedMods

func ReleasedMods(ev Event, code Code, mods Modifier) bool

Types

type Action

type Action glfw.Action

func (Action) String

func (a Action) String() string

type Callback

type Callback func(Event)

type Code

type Code glfw.Key

Code represents a keyboard key

type Event

type Event interface {
	Code() Code
	Action() Action
	Character() rune
	Modifier(Modifier) bool

	Handled() bool
	Consume()
}

func NewCharEvent

func NewCharEvent(char rune, mods Modifier) Event

func NewPressEvent

func NewPressEvent(code Code, action Action, mods Modifier) Event

type FocusHandler

type FocusHandler interface {
	Handler
	FocusEvent()
	BlurEvent()
}

type Handler

type Handler interface {
	KeyEvent(Event)
}

type Modifier

type Modifier glfw.ModifierKey

type State

type State interface {
	Handler

	Down(Code) bool
	Up(Code) bool

	Shift() bool
	Ctrl() bool
	Alt() bool
	Super() bool
}

func NewState

func NewState() State

Jump to

Keyboard shortcuts

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