GD_Pygame/ui.py

34 lines
569 B
Python
Raw Normal View History

2024-02-27 19:42:19 +01:00
#!/usr/bin/python3
class UI:
2024-02-27 20:12:13 +01:00
def __init__(self, app):
self.app = app
self.main_menu = MainMenu(app)
2024-02-27 19:42:19 +01:00
self.current_page = "main_menu"
2024-02-27 20:12:13 +01:00
def draw(self):
page = getattr(self, self.current_page)
page.draw()
def update(self):
page = getattr(self, self.current_page)
page.update()
2024-02-27 19:42:19 +01:00
class Page:
2024-02-27 20:12:13 +01:00
def __init__(self, app):
self.app = app
def draw(self):
pass
def update(self):
pass
class MainMenu(Page):
def draw(self):
self.app.screen.fill(self.app.blue)