コード例 #1
0
// Requires visual inspection
func TestMenu(t *testing.T) {
	i0 := FruitItem{Item{Label: "Apple"}}
	i1 := Add(MakeRadioItem("Banana", &BananaCherry, 0), Separator)
	i2 := MakeRadioItem("Cherry", &BananaCherry, 1)
	i3 := FruitItem{Item{Label: "Date", Flags: Disabled | Separator}}
	i4 := MakeCheckItem("Elderberry", true, func(val bool) { fmt.Printf("Elderberry=%v\n", val) })
	i5 := MakeSimpleItem("Fig", func() { fmt.Printf("Fig!\n") })
	i6 := MakeSimpleItem("Quit", func() { nimble.Quit() })
	theMenu = Menu{Label: "Fruits",
		Items: []ItemInterface{&i0, i1, i2, &i3, i4, i5, i6}}
	nimble.AddRenderClient(&context{})
	nimble.AddMouseObserver(&theMenu)
	nimble.Run(nil)
}
コード例 #2
0
ファイル: main.go プロジェクト: ArchRobison/FrequonInvaders
func main() {
	var winSpec nimble.WindowSpec = nil
	if devConfig {
		for _, fun := range profileStart() {
			defer fun()
		}
		if benchmarking {
			winSpec = &windowSpec{1920, 1080, "benchmark"}
		} else {
			winSpec = &windowSpec{1024, 600, "debug"}
		}
	}
	initMenuItem()
	rand.Seed(time.Now().UnixNano())
	nimble.AddRenderClient(context{})
	nimble.AddMouseObserver(context{})
	nimble.AddKeyObserver(context{})
	nimble.Run(winSpec)
}