Messing arround with gioui
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user