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" "os"
"gioui.org/app" "gioui.org/app"
"gioui.org/op"
"gioui.org/widget/material"
) )
const ( const (
@@ -14,6 +16,7 @@ const (
func main() { func main() {
go func() { go func() {
w := &app.Window{} w := &app.Window{}
w.Option(app.Size(500, 500), app.Title("LinuxPA"))
if err := ui(w); err != nil { if err := ui(w); err != nil {
fmt.Println(err) fmt.Println(err)
} }
@@ -23,12 +26,17 @@ func main() {
} }
func ui(w *app.Window) error { func ui(w *app.Window) error {
th := material.NewTheme()
op := &op.Ops{}
for { for {
switch e := w.Event().(type) { switch e := w.Event().(type) {
case app.DestroyEvent: case app.DestroyEvent:
return e.Err return e.Err
case app.FrameEvent: case app.FrameEvent:
ctx := app.NewContext(op, e)
lbl := material.Body1(th, "Hello there!")
lbl.Layout(ctx)
e.Frame(op)
} }
} }
} }