gui

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KeyPressDelayNS  = 500_000_000
	KeyPressRepeatNS = 30_000_000
	KeyPressResetNS  = 60_000_000
)

Functions

func WithCursorImage added in v0.0.9

func WithCursorImage(img image.Image) func(g *GUI) error

func WithFontDPI

func WithFontDPI(dpi float64) func(g *GUI) error

func WithFontFamily

func WithFontFamily(family string) func(g *GUI) error

func WithFontSize

func WithFontSize(size float64) func(g *GUI) error

func WithHinter

func WithHinter(h hinters.Hinter) func(g *GUI) error

func WithLigatures added in v0.0.9

func WithLigatures(enable bool) func(g *GUI) error

func WithOpacity added in v0.0.8

func WithOpacity(opacity float64) func(g *GUI) error

Types

type GUI

type GUI struct {
	// contains filtered or unexported fields
}

func New

func New(terminal *termutil.Terminal, options ...Option) (*GUI, error)

func (*GUI) CellSize

func (g *GUI) CellSize() image.Point

func (*GUI) ClearHighlight

func (g *GUI) ClearHighlight()

func (*GUI) Draw

func (g *GUI) Draw(screen *ebiten.Image)

Draw renders the terminal GUI to the ebtien window. Required to implement the ebiten interface.

func (*GUI) Highlight

func (g *GUI) Highlight(start termutil.Position, end termutil.Position, label string, img image.Image)

func (*GUI) Layout

func (g *GUI) Layout(outsideWidth, outsideHeight int) (int, int)

Layout provides the terminal gui size in pixels. Required to implement the ebiten interface.

func (*GUI) RequestScreenshot

func (g *GUI) RequestScreenshot(filename string)

func (*GUI) ResetCursor

func (g *GUI) ResetCursor()

func (*GUI) Run

func (g *GUI) Run() error

func (*GUI) SetCursorToPointer

func (g *GUI) SetCursorToPointer()

func (*GUI) ShowError

func (g *GUI) ShowError(msg string)

func (*GUI) ShowMessage

func (g *GUI) ShowMessage(msg string)

func (*GUI) ShowPopup

func (g *GUI) ShowPopup(msg string, fg color.Color, bg color.Color, duration time.Duration)

func (*GUI) Update

func (g *GUI) Update() error

Update changes the terminal GUI state - all user-initiated modification should happen here.

type MouseState

type MouseState uint8
const (
	MouseStateNone MouseState = iota
	MouseStatePressed
)

type Option

type Option func(g *GUI) error

func WithStartupFunc

func WithStartupFunc(f func(g *GUI)) Option

type WindowManipulator

type WindowManipulator struct {
	// contains filtered or unexported fields
}

func NewManipulator

func NewManipulator(g *GUI) *WindowManipulator

func (*WindowManipulator) CellSizeInPixels

func (m *WindowManipulator) CellSizeInPixels() (int, int)

func (*WindowManipulator) GetTitle

func (m *WindowManipulator) GetTitle() string

func (*WindowManipulator) IsFullscreen

func (m *WindowManipulator) IsFullscreen() bool

func (*WindowManipulator) Maximise

func (m *WindowManipulator) Maximise()

func (*WindowManipulator) Minimise

func (m *WindowManipulator) Minimise()

func (*WindowManipulator) Move

func (m *WindowManipulator) Move(x, y int)

func (*WindowManipulator) Position

func (m *WindowManipulator) Position() (int, int)

func (*WindowManipulator) ReportError

func (m *WindowManipulator) ReportError(err error)

func (*WindowManipulator) ResizeInChars

func (m *WindowManipulator) ResizeInChars(cols int, rows int)

func (*WindowManipulator) ResizeInPixels

func (m *WindowManipulator) ResizeInPixels(x int, y int)

func (*WindowManipulator) Restore

func (m *WindowManipulator) Restore()

func (*WindowManipulator) RestoreTitleFromStack

func (m *WindowManipulator) RestoreTitleFromStack()

func (*WindowManipulator) SaveTitleToStack

func (m *WindowManipulator) SaveTitleToStack()

func (*WindowManipulator) ScreenSizeInChars

func (m *WindowManipulator) ScreenSizeInChars() (int, int)

func (*WindowManipulator) ScreenSizeInPixels

func (m *WindowManipulator) ScreenSizeInPixels() (int, int)

func (*WindowManipulator) SetFullscreen

func (m *WindowManipulator) SetFullscreen(enabled bool)

func (*WindowManipulator) SetTitle

func (m *WindowManipulator) SetTitle(title string)

func (*WindowManipulator) SizeInChars

func (m *WindowManipulator) SizeInChars() (int, int)

func (*WindowManipulator) SizeInPixels

func (m *WindowManipulator) SizeInPixels() (int, int)

func (*WindowManipulator) State

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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