Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 17, 2015 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/f1baa1b311864b330d25 to your computer and use it in GitHub Desktop.
Save mattn/f1baa1b311864b330d25 to your computer and use it in GitHub Desktop.
package main
import (
"flag"
"github.com/google/gxui"
"github.com/google/gxui/drivers/gl"
"github.com/google/gxui/themes/dark"
)
var data = flag.String("data", "data", "path to data")
func appMain(driver gxui.Driver) {
theme := dark.CreateTheme(driver)
font := driver.CreateFont("Ricty-Regular.ttf", 20)
font.LoadGlyphs(32, 126)
theme.(*dark.Theme).DefaultFont = font
button := theme.CreateButton()
button.SetText("右... 右... いや左... そこ... そこを押せ!")
layout := theme.CreateLinearLayout()
layout.AddChild(button)
layout.SetHorizontalAlignment(gxui.AlignCenter)
window := theme.CreateWindow(500, 200, "俺のアップ")
window.AddChild(layout)
window.OnClose(driver.Terminate)
button.OnClick(func(ev gxui.MouseEvent) {
window.Close()
})
gxui.EventLoop(driver)
}
func main() {
flag.Parse()
gl.StartDriver(*data, appMain)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment