docs / start

gru · 0.7.0

Start here

Get a window on screen, then explore the demo catalog. Copy cmd/hello for a working frame loop before writing your own.

Requirements

  1. Go toolchain (current stable is fine).
  2. Clone github.com/ledocorp/GRU, or go get the module into your app.
  3. Windows for the full path. WebView samples need the WebView2 Runtime.

At runtime the working directory (or package layout) must resolve assets/fonts/.

Install as a module

go get github.com/ledocorp/gru@v0.7.0
import "github.com/ledocorp/gru/ui"

Run the samples

From the repository root (folder with go.mod and assets/):

go run ./cmd/hello
go run -tags webview2 ./cmd/webviewhello
go run -tags grudemo .
go run -tags "grudemo,webview2" .
CommandWhat it is
cmd/helloSmall native window with Button / Card. Correct loop to copy.
cmd/webviewhelloSame idea with a FillClient WebView below chrome.
-tags grudemo35-scene catalog. Tab = next scene, F12 = Inspector.

Scaffold an app

go run ./cmd/gru new myapp
go run ./cmd/gru new myapp --webview

See CLI for build and package.

Frame loop (what hello does)

  1. Open a Raylib window (often undecorated; Gru draws the title bar).
  2. Init font atlases and supersampling.
  3. doc := ui.NewDocument(w, h), then add widgets under doc.Root.
  4. Each frame: drain the document queue, Update, Layout if dirty, draw or blit.

Details: godoc on ui.NewDocument, or the architecture page.

Composition (short)

PreferAvoid
Panel / Card + ListTileOne-off “sidebar” / “settings row” widget types
Flex column / rowAbsolute stacks for whole pages
Theme styles (card, panel, …)Hard-coded colors on every node

Full recipes: Composition.

Next: CLI · Composition · Demos