示例#1
0
func WelcomeScreen() {

	title := "WELCOME TO GM HELPER"
	ver := "0.0.1"
	welcometxt := "Hit <space> to bring up the menu at any time except when entering text into a dialog box. Also, you can hit <q> to exit back to the welcome screen. This is a complete work in progress and will have better information here in the future."

	tPar := termui.NewPar(title)
	tPar.Height = 3
	tPar.BorderLabel = "GM HELPER"

	tVer := termui.NewPar(ver)
	tVer.Height = 3
	tVer.BorderLabel = "Version"

	tWelc := termui.NewPar(welcometxt)
	tWelc.Height = 9
	//tWelc.WrapLength = 30
	tWelc.BorderLabel = "Welcome"
	tmp := termui.TermWidth()
	tWelc.WrapLength = uint(tmp) - 4

	termui.Body.Rows = termui.Body.Rows[:0] // clears the rows
	termui.Body.AddRows(
		termui.NewRow(
			termui.NewCol(6, 0, tPar)),
		termui.NewRow(
			termui.NewCol(6, 0, tVer)),
		termui.NewRow(
			termui.NewCol(12, 0, tWelc)),
	)

	termui.Handle("/sys/kbd/q", func(termui.Event) {
		termui.StopLoop()
	})

	termui.Body.Align()
	termui.Render(termui.Body)
}
示例#2
0
func Menu() {

	txt := "Here is the placeholder for our menu:"

	tPar := termui.NewPar(txt)
	tPar.Height = 4

	termui.Body.Rows = termui.Body.Rows[:0]
	termui.Body.AddRows(
		termui.NewRow(
			termui.NewCol(4, 4, tPar)),
	)

	termui.Body.Align()
	termui.Render(termui.Body)

	termui.Handle("/sys/kbd/q", func(termui.Event) {
		//termui.StopLoop()
		WelcomeScreen()
	})
}