From 901406351ee2f48d0a6d6f27dabab5e66ffe16e4 Mon Sep 17 00:00:00 2001 From: Nicolas Margulies Date: Fri, 6 Nov 2020 16:40:43 +0100 Subject: [PATCH] Better menus --- dungeonbattle/menus.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/dungeonbattle/menus.py b/dungeonbattle/menus.py index e188864..f2da237 100644 --- a/dungeonbattle/menus.py +++ b/dungeonbattle/menus.py @@ -1,7 +1,11 @@ +from enum import Enum, auto + + class Menu: - def __init__(self, values:list): - self.values = values + values:list + + def __init__(self): self.position = 0 def go_up(self): @@ -11,4 +15,19 @@ class Menu: self.position = min(len(self.values)-1, self.position +1) def validate(self): - return self.values[self.position] \ No newline at end of file + return self.values[self.position] + +class MainMenuValues(Enum): + START = auto() + SETTINGS = auto() + EXIT = auto() + +class MainMenu(Menu): + + values = [ e for e in MainMenuValues ] + +class ArbitraryMenu: + + def __init__(self, values:list): + super().__init__(self) + self.values = values \ No newline at end of file