lay out a grid for game page

trunk
vilmibm 2022-07-08 00:56:47 -05:00
parent efeda058ee
commit 991ef3595b
1 changed files with 27 additions and 4 deletions

View File

@ -65,21 +65,44 @@ func _main() error {
AddButtons([]string{"hey. let's go"}). AddButtons([]string{"hey. let's go"}).
SetDoneFunc(func(_ int, _ string) { SetDoneFunc(func(_ int, _ string) {
pages.SwitchToPage("main") pages.SwitchToPage("main")
app.ResizeToFullScreen(pages)
}).SetText("h e r m e t i c u m"), }).SetText("h e r m e t i c u m"),
false, true,
true) true)
mainPage := tview.NewList(). mainPage := tview.NewList().
AddItem("jack in", "connect using an existing account", '1', nil). AddItem("jack in", "connect using an existing account", '1', func() {
pages.SwitchToPage("game")
}).
AddItem("rez a toon", "create a new account", '2', nil). AddItem("rez a toon", "create a new account", '2', nil).
AddItem("open the hood", "client configuration", '3', nil). AddItem("open the hood", "client configuration", '3', nil).
AddItem("get outta here", "quit the client", '4', func() { AddItem("get outta here", "quit the client", '4', func() {
app.Stop() app.Stop()
}) })
mainPage.SetRect(0, 0, 100, 100) pages.AddPage("main", mainPage, true, false)
pages.AddPage("main", mainPage, false, false) gamePage := tview.NewGrid().
SetRows(1, 40, 3).
SetColumns(-1, -1).
SetBorders(true).
AddItem(
tview.NewTextView().SetTextAlign(tview.AlignLeft).SetText("h e r m e t i c u m"),
0, 0, 1, 1, 1, 1, false).
AddItem(
tview.NewTextView().SetTextAlign(tview.AlignRight).SetText("TODO server status"),
0, 1, 1, 1, 1, 1, false).
AddItem(
tview.NewTextView().SetText("TODO game messages"),
1, 0, 1, 1, 10, 20, false).
AddItem(
tview.NewTextView().SetText("TODO detail window"),
1, 1, 1, 1, 10, 10, false).
AddItem(
tview.NewTextView().SetText("TODO input"),
2, 0, 1, 2, 1, 30, false)
pages.AddPage("game", gamePage, true, false)
return app.SetRoot(pages, true).SetFocus(pages).Run() return app.SetRoot(pages, true).SetFocus(pages).Run()
} }