application

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package application owns the imzero2 process lifecycle: configuration parsing, observability bootstrap, render-loop driver wiring, profiling hooks, and graceful shutdown. The Application[U] generic parameterizes the FFFI2 unmarshaller plugged into the Rust child process.

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedsToBeLaunchedBeforeRun = eh.Errorf("application needs to be launched before run")
View Source
var PackageProps = packageprops.Props{
	WASMWASI:         packageprops.WASMCompiles,
	WASMJS:           packageprops.WASMCompiles,
	WASMFreestanding: packageprops.WASMCompiles,
}

PackageProps records this package's curated properties (ADR-0080). Seeded by `boxer code analysis golang wasmsurvey props generate`; curate by hand. The same group's `props verify` reconciles it.

Functions

This section is empty.

Types

type Application

type Application[U runtime.UnmarshallReaderI] struct {
	FffiEstablishedHandler      func(fffi *runtime.Fffi2[U]) error
	BeforeFirstFrameInitHandler func() error
	RenderLoopHandler           func() error
	Config                      *Config
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication[U runtime.UnmarshallReaderI](cfg *Config, unmarshaller U) (app *Application[U], err error)

func (*Application[U]) Launch

func (inst *Application[U]) Launch() (err error)

func (*Application[U]) Run

func (inst *Application[U]) Run() (err error)

func (*Application[U]) Shutdown added in v0.0.20

func (inst *Application[U]) Shutdown()

Shutdown asks the render loop to stop at the next frame boundary, so that Run returns normally and its caller's deferred cleanup runs. It is safe to call from any goroutine — including a signal handler — and is idempotent.

It does not preempt an in-flight frame: a loop blocked reading from a wedged client will not observe this. A caller that must bound the wait (a signal handler, a supervisor) needs its own escalation path.

type Config

type Config struct {
	ImZeroSkiaClientConfig *ImZeroClientConfig

	MainFontTTF       string
	MonoFontTTF       string
	PhosphorFontTTF   string
	FallbackFontTTF   string
	MainFontTweak     FontTweakConfig
	MonoFontTweak     FontTweakConfig
	PhosphorFontTweak FontTweakConfig
	FallbackFontTweak FontTweakConfig
	ClientBinary      string
	ImZeroCmdOutFile  string
	ImZeroCmdInFile   string

	MainFontSizeInPixels float32
	// contains filtered or unexported fields
}

func (*Config) FromContext

func (inst *Config) FromContext(nameTransf config.NameTransformFunc, ctx *cli.Context) (nMessages int)

func (*Config) ToCliFlags

func (inst *Config) ToCliFlags(nameTransf config.NameTransformFunc, envVarNameTransf config.NameTransformFunc) []cli.Flag

func (*Config) Validate

func (inst *Config) Validate(force bool) (nMessages int)

type FontTweakConfig

type FontTweakConfig struct {
	Scale         float32
	YOffsetFactor float32
	YOffset       float32
}

type ImZeroClientConfig

type ImZeroClientConfig struct {
	AppTitle                string `json:"appTitle"`
	Fullscreen              string `json:"fullscreen"`
	InitialMainWindowWidth  string `json:"initialMainWindowWidth"`
	InitialMainWindowHeight string `json:"initialMainWindowHeight"`
	AllowMainWindowResize   string `json:"allowMainWindowResize"`
	ExportBasePath          string `json:"exportBasePath"`
	Vsync                   string `json:"vsync"`
	BackgroundColorRGBA     string `json:"backgroundColorRGBA"`
	BackdropFilter          string `json:"backdropFilter"`
	// contains filtered or unexported fields
}

func (*ImZeroClientConfig) FromContext

func (inst *ImZeroClientConfig) FromContext(nameTransf config.NameTransformFunc, ctx *cli.Context) (nMessages int)

func (*ImZeroClientConfig) PassthroughArgs

func (inst *ImZeroClientConfig) PassthroughArgs(args []string) (argsOut []string)

func (*ImZeroClientConfig) ToCliFlags

func (inst *ImZeroClientConfig) ToCliFlags(nameTransf config.NameTransformFunc, envVarNameTransf config.NameTransformFunc) []cli.Flag

func (*ImZeroClientConfig) Validate

func (inst *ImZeroClientConfig) Validate(force bool) (nMessages int)

Jump to

Keyboard shortcuts

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