aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/region.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/region.go b/test/region.go
index afd739e..0b99a3a 100644
--- a/test/region.go
+++ b/test/region.go
@@ -11,6 +11,10 @@ import (
"github.com/faiface/mainthread"
)
+var (
+ bg = gui.HexToColor("#999999") // background color
+)
+
func main() {
mainthread.Run(run)
}
@@ -24,9 +28,10 @@ func run() {
mux, env := gui.NewMux(w)
// Create region in bottom-right quadrant of window
- region := layout.NewRegion(mux.MakeEnv(), func(r image.Rectangle) image.Rectangle {
+ resize := func(r image.Rectangle) image.Rectangle {
return image.Rect(r.Min.X+r.Dx()/2, r.Min.Y+r.Dy()/2, r.Max.X, r.Max.Y)
- })
+ }
+ region := layout.NewRegion(mux.MakeEnv(), resize, layout.Background(bg))
go blinker(region)
for event := range env.Events() {
@@ -64,9 +69,9 @@ func blinker(env gui.Env) {
go func() {
for i := 0; i < 3; i++ {
env.Draw() <- redraw(false)
- time.Sleep(time.Second / 3)
+ time.Sleep(time.Second / 6)
env.Draw() <- redraw(true)
- time.Sleep(time.Second / 3)
+ time.Sleep(time.Second / 6)
}
}()
}