input

package
v0.0.0-...-ba0b20d Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PixelFormatBGRA   = gfxcore.PixelFormatBGRA
	PixelFormatRGBA   = gfxcore.PixelFormatRGBA
	PixelFormatRGB565 = gfxcore.PixelFormatRGB565
)

Variables

View Source
var (
	ColorBlack       = gfxcore.ColorBlack
	ColorWhite       = gfxcore.ColorWhite
	ColorRed         = gfxcore.ColorRed
	ColorGreen       = gfxcore.ColorGreen
	ColorBlue        = gfxcore.ColorBlue
	ColorGray        = gfxcore.ColorGray
	ColorLightGray   = gfxcore.ColorLightGray
	ColorDarkGray    = gfxcore.ColorDarkGray
	ColorTransparent = gfxcore.ColorTransparent

	NewColor    = gfxcore.NewColor
	NewColorRGB = gfxcore.NewColorRGB
	NewColorHex = gfxcore.NewColorHex
	NewRect     = gfxcore.NewRect
	NewBuffer   = gfxcore.NewBuffer
)

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Open() error
	Close() error
	Size() (width, height int)
	Buffer() *core.Buffer
	Flush() error
	FlushRect(core.Rect) error
	Info() string
	HasSystemCursor() bool
}

Backend is the display backend interface. Implementations include framebuffer (Linux /dev/fb0) and Wayland.

type Buffer

type Buffer = gfxcore.Buffer

type Color

type Color = gfxcore.Color

type Event

type Event struct {
	Type EventType

	// Mouse events
	X, Y        int
	MouseButton MouseButton

	// Keyboard events
	Key       Key
	Rune      rune
	Modifiers Modifiers

	// Shortcut events
	ShortcutID uint32
	WindowID   uint32
	Scope      uint32
}

Event represents an input event.

func (Event) HasMod

func (e Event) HasMod(mod Modifiers) bool

HasMod returns true if the modifier is set.

func (Event) IsAlt

func (e Event) IsAlt() bool

IsAlt returns true if alt is held.

func (Event) IsCtrl

func (e Event) IsCtrl() bool

IsCtrl returns true if ctrl is held.

func (Event) IsShift

func (e Event) IsShift() bool

IsShift returns true if shift is held.

type EventType

type EventType int

EventType represents the type of an event.

const (
	EventNone EventType = iota
	EventMouseMove
	EventMouseButtonPress
	EventMouseButtonRelease
	EventKeyPress
	EventKeyRelease
	EventFocusIn
	EventFocusOut
	EventQuit
	EventResize
	EventShortcut
)

type InputHandler

type InputHandler interface {
	Open() error
	Start()
	Close() error
	Poll() *Event
	MousePosition() (x, y int)
	SetScreenSize(width, height int)
}

InputHandler is the input handler interface. Implementations include evdev (Linux raw input) and Wayland seat.

type Key

type Key int

Key represents a keyboard key.

const (
	KeyNone Key = iota
	KeyEscape
	KeyBackspace
	KeyTab
	KeyEnter
	KeySpace
	KeyLeft
	KeyRight
	KeyUp
	KeyDown
	KeyHome
	KeyEnd
	KeyPageUp
	KeyPageDown
	KeyInsert
	KeyDelete
	KeyF1
	KeyF2
	KeyF3
	KeyF4
	KeyF5
	KeyF6
	KeyF7
	KeyF8
	KeyF9
	KeyF10
	KeyF11
	KeyF12
	KeyLeftShift
	KeyRightShift
	KeyLeftCtrl
	KeyRightCtrl
	KeyLeftAlt
	KeyRightAlt
	KeyCapsLock
	KeyNumLock
	KeyScrollLock
)

type Modifiers

type Modifiers uint8

Modifiers represents keyboard modifiers.

const (
	ModShift Modifiers = 1 << iota
	ModCtrl
	ModAlt
	ModCapsLock
)

type MouseButton

type MouseButton int

MouseButton represents a mouse button.

const (
	MouseButtonNone MouseButton = iota
	MouseButtonLeft
	MouseButtonMiddle
	MouseButtonRight
	MouseButtonWheelUp
	MouseButtonWheelDown
	MouseButtonWheelLeft
	MouseButtonWheelRight
)

type PixelFormat

type PixelFormat = gfxcore.PixelFormat

type Point

type Point = gfxcore.Point

type Rect

type Rect = gfxcore.Rect

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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