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