aboutsummaryrefslogtreecommitdiff
path: root/client/menu.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-01-15 16:08:31 +0100
committerJulien Dessaux2021-01-15 16:08:31 +0100
commit3d1d8ba0a772c3c038f072095d87d0b46bd1efb2 (patch)
tree4b51303ee3a4e0c094cc3b9ab3aefc1846d85559 /client/menu.go
parentHave the configuration loadFile function return a pointer (diff)
downloadshell-game-launcher-3d1d8ba0a772c3c038f072095d87d0b46bd1efb2.tar.gz
shell-game-launcher-3d1d8ba0a772c3c038f072095d87d0b46bd1efb2.tar.bz2
shell-game-launcher-3d1d8ba0a772c3c038f072095d87d0b46bd1efb2.zip
Added generation of the menu display
Diffstat (limited to '')
-rw-r--r--client/menu.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/client/menu.go b/client/menu.go
new file mode 100644
index 0000000..773060c
--- /dev/null
+++ b/client/menu.go
@@ -0,0 +1,21 @@
+package client
+
+import "fmt"
+
+func (s *State) displayMenu() {
+ menu := s.config.Menus[s.currentMenu]
+ fmt.Println("\033[2J") // clear the screen
+ fmt.Println(menu.Banner)
+ output := ""
+ prefix := ""
+ for i := 0; i < menu.XOffset; i++ {
+ prefix += " "
+ }
+ for i := 0; i < menu.YOffset; i++ {
+ output += "\n"
+ }
+ fmt.Printf("%s", output)
+ for i := 0; i < len(menu.MenuEntries); i++ {
+ fmt.Printf("%s%s) %s\n", prefix, menu.MenuEntries[i].Key, menu.MenuEntries[i].Label)
+ }
+}