diff --git a/assets/textures/floors/floor_01.png b/assets/textures/floors/floor_01.png index 33bbfed..c299452 100644 Binary files a/assets/textures/floors/floor_01.png and b/assets/textures/floors/floor_01.png differ diff --git a/assets/textures/floors/floor_01.xcf b/assets/textures/floors/floor_01.xcf index 174ca54..4540721 100644 Binary files a/assets/textures/floors/floor_01.xcf and b/assets/textures/floors/floor_01.xcf differ diff --git a/gd_pygame.py b/gd_pygame.py index 25f0d79..0dd88ee 100644 --- a/gd_pygame.py +++ b/gd_pygame.py @@ -4,6 +4,7 @@ import pygame from pygame._sdl2 import Window from dataclasses import dataclass from wobbl_tools.data_file import load_dataclass_json, save_dataclass_json +from ui import UI @dataclass @@ -28,9 +29,11 @@ class GDPygame: setattr(self.settings, "save", lambda: save_dataclass_json(self.settings, "settings.json")) self.fps = self.settings.fps + self.ui = UI(self) # colors self.gray = (20, 20, 20) + self.blue = (10, 10, 140) # pygame objects self.clock = pygame.time.Clock() @@ -58,6 +61,8 @@ class GDPygame: def loop(self): self.screen.fill(self.gray) + self.ui.draw() + self.get_events() if not self.running: return diff --git a/ui.py b/ui.py index a3d853c..2ef2141 100644 --- a/ui.py +++ b/ui.py @@ -1,14 +1,33 @@ #!/usr/bin/python3 class UI: - def __init__(self): + def __init__(self, app): + self.app = app + + self.main_menu = MainMenu(app) + self.current_page = "main_menu" - self.main_menu = Page() + def draw(self): + page = getattr(self, self.current_page) + page.draw() + + def update(self): + page = getattr(self, self.current_page) + page.update() class Page: - def __init__(self, elements: dict=None): - if not elements is None: - for name, element in elements.items(): - setattr(self, name, element) + 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)