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
- Go toolchain (current stable is fine).
- Clone github.com/ledocorp/GRU, or
go getthe module into your app. - 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" .
| Command | What it is |
|---|---|
cmd/hello | Small native window with Button / Card. Correct loop to copy. |
cmd/webviewhello | Same idea with a FillClient WebView below chrome. |
-tags grudemo | 35-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)
- Open a Raylib window (often undecorated; Gru draws the title bar).
- Init font atlases and supersampling.
doc := ui.NewDocument(w, h), then add widgets underdoc.Root.- Each frame: drain the document queue,
Update,Layoutif dirty, draw or blit.
Details: godoc on ui.NewDocument, or the architecture page.
Composition (short)
| Prefer | Avoid |
|---|---|
Panel / Card + ListTile | One-off “sidebar” / “settings row” widget types |
| Flex column / row | Absolute stacks for whole pages |
Theme styles (card, panel, …) | Hard-coded colors on every node |
Full recipes: Composition.
Next: CLI · Composition · Demos