app

package
v0.0.0-...-7e1b392 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyConfiguredDefaultFont

func ApplyConfiguredDefaultFont() error

ApplyConfiguredDefaultFont loads config/fonts.ini and sets Default/UI fonts. It always applies bitmap fallback first so rendering remains functional.

Types

type App

type App struct {
	OnQuit   func()
	OnEscape func() // If set, called on Escape instead of quitting.
	// contains filtered or unexported fields
}

App represents the main application with a single root widget that fills the entire screen.

func New

func New(opts Options) *App

New creates a new application with the given options.

func (*App) AddFocusable

func (a *App) AddFocusable(widgets ...graphics.Widget)

AddFocusable registers a widget for keyboard focus (tab navigation). These are typically interactive leaf widgets (buttons, text inputs) that live somewhere inside the root widget tree.

func (*App) Backend

func (a *App) Backend() graphics.Backend

Backend returns the display backend.

func (*App) ClearFocusables

func (a *App) ClearFocusables()

ClearFocusables removes all registered focusable widgets.

func (*App) Focus

func (a *App) Focus(widget graphics.Widget)

Focus sets keyboard focus to a specific widget.

func (*App) FocusNext

func (a *App) FocusNext()

FocusNext moves focus to the next focusable widget.

func (*App) FocusPrevious

func (a *App) FocusPrevious()

FocusPrevious moves focus to the previous focusable widget.

func (*App) Input

func (a *App) Input() graphics.InputHandler

Input returns the input handler.

func (*App) Quit

func (a *App) Quit()

Quit stops the application.

func (*App) Redraw

func (a *App) Redraw()

Redraw marks the entire screen for redraw.

func (*App) Root

func (a *App) Root() graphics.Widget

Root returns the current root widget.

func (*App) Run

func (a *App) Run() error

Run starts the main application loop. The root widget is resized to fill the entire framebuffer.

func (*App) SetBackground

func (a *App) SetBackground(c graphics.Color)

SetBackground sets the background color.

func (*App) SetDebugDamage

func (a *App) SetDebugDamage(enabled bool)

SetDebugDamage enables or disables the damage flash overlay. When enabled, repainted regions flash red and fade out over several frames, similar to Android's "Show surface updates" developer option.

func (*App) SetDebugFlashColor

func (a *App) SetDebugFlashColor(c graphics.Color)

SetDebugFlashColor sets the flash overlay color (default semi-transparent red).

func (*App) SetDebugFlashFrames

func (a *App) SetDebugFlashFrames(frames int)

SetDebugFlashFrames sets how many frames each flash persists (default 6).

func (*App) SetFPS

func (a *App) SetFPS(fps int)

SetFPS sets the target frames per second.

func (*App) SetRoot

func (a *App) SetRoot(widget graphics.Widget)

SetRoot sets the single root widget. It will be resized to fill the entire screen when Run() is called.

func (*App) SetTitle

func (a *App) SetTitle(title string)

SetTitle sets the application title (informational only).

func (*App) Size

func (a *App) Size() (width, height int)

Size returns the screen size.

type Options

type Options struct {
	Title         string                // Window title.
	Width         int                   // Window width; 0 = default (800).
	Height        int                   // Window height; 0 = default (600).
	Backend       graphics.Backend      // Display backend (required).
	Input         graphics.InputHandler // Input handler (required).
	FPS           int                   // Target FPS; 0 = default (60).
	Background    graphics.Color        // Background color.
	BackgroundSet bool                  // When true, use Background even if it is transparent (0 alpha).
}

Options configures a new application.

Jump to

Keyboard shortcuts

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