splash

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 7 Imported by: 0

README

gioui-splash

A cross-platform splash screen for Go, based on Gio UI

About the Gio UI Splash Widget

Sometimes you'll need a splash screen, or loading indicator, optionally with a progress bar. gioui-splash is a small widget for Gio UI, supporting:

  • any image to be displayed in a non-decorated window
  • an optional progress bar to display asynchronous task progress
  • tweaking of the position, size, and color of the progress bar

Gio UI is a library for writing cross-platform immediate mode GUI-s in Go.

A minimal example can be run like this:

go run github.com/gesellix/gioui-splash/cmd@latest

https://github.com/gesellix/gioui-splash/assets/432791/186c12ee-6d23-493a-b1d3-899c083f60c4

The example should work on any platform supported by Gio UI, including WebAssembly. See below for details.

Build and package with gogio

The gogio tool simplifies building and packaging your binaries.

go install gioui.org/cmd/gogio@latest
MacOS
gogio -x -target macos -ldflags "-s -w" -appid splash -icon appicon.png -o splash.app ./cmd
open splash_arm64.app 
#open splash_amd64.app 
Windows
gogio -x -target windows -ldflags "-s -w" -appid splash -icon appicon.png -o splash.exe ./cmd
.\splash.exe
WebAssembly
gogio -x -target js -ldflags "-s -w" -appid splash -icon appicon.png -o wasm ./cmd
go run ./wasm

Contributing/Developing

A modern Golang installation is required. Some additional dependencies might be necessary, please consult the documentation at https://gioui.org/doc/install.

A fresh clone can be run like this:

git clone git@github.com:/gesellix/gioui-splash.git
cd guiui-splash
go run ./cmd

Roadmap/ideas

  • Refactor parts of the example code from cmd/main.go, so that custom Go code (the application code) won't be mixed with UI code.
  • Reduce the packaged binary size (can we exclude Gio's themes and text modules?)
  • Add tests, maybe using the gioui.org/gpu/headless module?
  • Consider using Gio's widget/material/progressbar - without forgetting about the binary size ;)

License

MIT License

Notes

Thanks to the Gui UI developers for the great project! Please head over to https://gioui.org/doc/contribute if you want to support their work.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Splash

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

func NewSplash

func NewSplash(img image.Image, progressInset layout.Inset, progressCol color.NRGBA) *Splash

func (*Splash) Layout

func (s *Splash) Layout(gtx layout.Context) layout.Dimensions

func (*Splash) SetProgress

func (s *Splash) SetProgress(progress float64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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