Beispiel #1
0
// Do initializations that would cause "initialization loop" if
// embedded into the respective var declarations.
func initMenuItem() {
	beginGameItem = menu.MakeSimpleItem("Begin Game", func() {
		setMode(modeGame)
	})
	trainingItem = menu.MakeSimpleItem("Training", func() {
		setMode(modeTraining)
	})
	highScores = menu.MakeSimpleItem("High Scores", func() {
		setMode(modeVanity)
	})
}
Beispiel #2
0
)

var (
	fileMenu     = menu.Menu{Label: "File"}
	displayMenu  = menu.Menu{Label: "Display", Items: []menu.ItemInterface{autoGain}}
	ratingsMenu  = menu.Menu{Label: "Ratings"}
	invadersMenu = menu.Menu{Label: "Invaders"}
	colorMenu    = menu.Menu{Label: "Color"}
)

// Items for "File" menu
var (
	beginGameItem, trainingItem *menu.SimpleItem

	exitItem = menu.MakeSimpleItem("Exit", func() {
		nimble.Quit()
	})
)

// Items for "Display" menu
var autoGain = menu.MakeCheckItem("Autogain", true, nil)

// Items for "Ratings" menu
var (
	highScores *menu.SimpleItem
	cpuSpeed   = menu.MakeSimpleItem("CPU Speed", func() {
		teletype.Reset()
		teletype.PrintUpper(fmt.Sprintf("HFT SPEED = %.1f GFlops\n", fourier.Benchmark()*1E-9))
	})
)