Messing arround with gioui

This commit is contained in:
Caleb Gardner
2024-10-18 06:43:39 -05:00
parent 645f2d8dd9
commit ff48fae713
+9 -1
View File
@@ -5,6 +5,8 @@ import (
"os"
"gioui.org/app"
"gioui.org/op"
"gioui.org/widget/material"
)
const (
@@ -14,6 +16,7 @@ const (
func main() {
go func() {
w := &app.Window{}
w.Option(app.Size(500, 500), app.Title("LinuxPA"))
if err := ui(w); err != nil {
fmt.Println(err)
}
@@ -23,12 +26,17 @@ func main() {
}
func ui(w *app.Window) error {
th := material.NewTheme()
op := &op.Ops{}
for {
switch e := w.Event().(type) {
case app.DestroyEvent:
return e.Err
case app.FrameEvent:
ctx := app.NewContext(op, e)
lbl := material.Body1(th, "Hello there!")
lbl.Layout(ctx)
e.Frame(op)
}
}
}