example: update gio version

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-13 18:29:39 +02:00
parent 8cd4c2e5de
commit 7672c08f46
5 changed files with 10 additions and 38 deletions
+1 -2
View File
@@ -3,9 +3,8 @@ module gioui.org/example
go 1.13 go 1.13
require ( require (
gioui.org v0.0.0-20191012123625-abb99eca5c54 gioui.org v0.0.0-20191013162339-8cd4c2e5de65
github.com/google/go-github/v24 v24.0.1 github.com/google/go-github/v24 v24.0.1
golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3 golang.org/x/exp v0.0.0-20191002040644-a1355ae1e2c3
golang.org/x/image v0.0.0-20190802002840-cff245a6509b
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
) )
+2 -2
View File
@@ -1,7 +1,7 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20191012123625-abb99eca5c54 h1:1LQMwF6UgHRaAbwvoaKWmnv5LwKt2HyXJooDvkNkmRg= gioui.org v0.0.0-20191013162339-8cd4c2e5de65 h1:94lyVLRIPhu95x3goGooL3ZxkDZgo9dRgR6Unecwre0=
gioui.org v0.0.0-20191012123625-abb99eca5c54/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY= gioui.org v0.0.0-20191013162339-8cd4c2e5de65/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
+3 -15
View File
@@ -17,6 +17,7 @@ import (
_ "net/http/pprof" _ "net/http/pprof"
"gioui.org/f32" "gioui.org/f32"
_ "gioui.org/font/gofont"
"gioui.org/gesture" "gioui.org/gesture"
"gioui.org/io/key" "gioui.org/io/key"
"gioui.org/io/pointer" "gioui.org/io/pointer"
@@ -25,16 +26,11 @@ import (
"gioui.org/op" "gioui.org/op"
"gioui.org/op/paint" "gioui.org/op/paint"
"gioui.org/text" "gioui.org/text"
"gioui.org/text/opentype"
"gioui.org/unit" "gioui.org/unit"
"gioui.org/widget" "gioui.org/widget"
"gioui.org/widget/material" "gioui.org/widget/material"
"github.com/google/go-github/v24/github" "github.com/google/go-github/v24/github"
"golang.org/x/image/font/gofont/gobold"
"golang.org/x/image/font/gofont/goitalic"
"golang.org/x/image/font/gofont/gomono"
"golang.org/x/image/font/gofont/goregular"
"golang.org/x/exp/shiny/materialdesign/icons" "golang.org/x/exp/shiny/materialdesign/icons"
) )
@@ -68,18 +64,10 @@ type user struct {
avatar image.Image avatar image.Image
} }
var shaper *text.Shaper
var theme *material.Theme var theme *material.Theme
func init() { func init() {
s := new(text.Shaper) theme = material.NewTheme()
s.Register(text.Font{}, opentype.Must(opentype.Parse(goregular.TTF)))
s.Register(text.Font{Style: text.Italic}, opentype.Must(opentype.Parse(goitalic.TTF)))
s.Register(text.Font{Weight: text.Bold}, opentype.Must(opentype.Parse(gobold.TTF)))
s.Register(text.Font{Typeface: "mono"}, opentype.Must(opentype.Parse(gomono.TTF)))
shaper = s
theme = material.NewTheme(s)
theme.Color.Text = rgb(0x333333) theme.Color.Text = rgb(0x333333)
theme.Color.Hint = rgb(0xbbbbbb) theme.Color.Hint = rgb(0xbbbbbb)
} }
@@ -136,7 +124,7 @@ func (u *UI) layoutTimings(gtx *layout.Context) {
layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() { layout.Inset{Top: unit.Dp(16)}.Layout(gtx, func() {
txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings) txt := fmt.Sprintf("m: %d %s", mallocs, u.profile.Timings)
lbl := theme.Caption(txt) lbl := theme.Caption(txt)
lbl.Font.Typeface = "mono" lbl.Font.Variant = "Mono"
lbl.Layout(gtx) lbl.Layout(gtx)
}) })
}) })
+2 -8
View File
@@ -9,12 +9,10 @@ import (
"log" "log"
"gioui.org/app" "gioui.org/app"
_ "gioui.org/font/gofont"
"gioui.org/layout" "gioui.org/layout"
"gioui.org/text" "gioui.org/text"
"gioui.org/text/opentype"
"gioui.org/widget/material" "gioui.org/widget/material"
"golang.org/x/image/font/gofont/goregular"
) )
func main() { func main() {
@@ -28,11 +26,7 @@ func main() {
} }
func loop(w *app.Window) error { func loop(w *app.Window) error {
shaper := new(text.Shaper) th := material.NewTheme()
shaper.Register(text.Font{}, opentype.Must(
opentype.Parse(goregular.TTF),
))
th := material.NewTheme(shaper)
gtx := &layout.Context{ gtx := &layout.Context{
Queue: w.Queue(), Queue: w.Queue(),
} }
+2 -11
View File
@@ -10,14 +10,12 @@ import (
"gioui.org/app" "gioui.org/app"
"gioui.org/layout" "gioui.org/layout"
"gioui.org/text" "gioui.org/text"
"gioui.org/text/opentype"
"gioui.org/unit" "gioui.org/unit"
"gioui.org/widget" "gioui.org/widget"
"gioui.org/widget/material" "gioui.org/widget/material"
_ "gioui.org/font/gofont"
"golang.org/x/exp/shiny/materialdesign/icons" "golang.org/x/exp/shiny/materialdesign/icons"
"golang.org/x/image/font/gofont/goitalic"
"golang.org/x/image/font/gofont/goregular"
) )
func main() { func main() {
@@ -36,14 +34,7 @@ func main() {
} }
func loop(w *app.Window) error { func loop(w *app.Window) error {
shaper := new(text.Shaper) th := material.NewTheme()
shaper.Register(text.Font{}, opentype.Must(
opentype.Parse(goregular.TTF),
))
shaper.Register(text.Font{Style: text.Italic}, opentype.Must(
opentype.Parse(goitalic.TTF),
))
th := material.NewTheme(shaper)
gtx := &layout.Context{ gtx := &layout.Context{
Queue: w.Queue(), Queue: w.Queue(),
} }