From dd1507a9fd8d390055af07e4f973127a27b173cb Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.uni-bielefeld.de> Date: Tue, 16 Jan 2024 13:53:22 +0100 Subject: [PATCH] Changed font of labels --- .../game_content/environment_config.yaml | 2 +- overcooked_simulator/gui_2d_vis/gui_theme.json | 18 ++++++++++++++++++ .../gui_2d_vis/overcooked_gui.py | 14 +++++++------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/overcooked_simulator/game_content/environment_config.yaml b/overcooked_simulator/game_content/environment_config.yaml index 4b3a9c26..1bee3dc3 100644 --- a/overcooked_simulator/game_content/environment_config.yaml +++ b/overcooked_simulator/game_content/environment_config.yaml @@ -4,4 +4,4 @@ plates: plate_delay: [ 5, 10 ] game: - time_limit_seconds: 5.0 + time_limit_seconds: 30.0 diff --git a/overcooked_simulator/gui_2d_vis/gui_theme.json b/overcooked_simulator/gui_2d_vis/gui_theme.json index 3ca11b55..3db73ba4 100644 --- a/overcooked_simulator/gui_2d_vis/gui_theme.json +++ b/overcooked_simulator/gui_2d_vis/gui_theme.json @@ -45,5 +45,23 @@ "misc": { "tool_tip_delay": "1.5" } + }, + "#timer_label": { + "colours": { + "normal_text": "#000000" + }, + "font": { + "size": 20, + "bold": 1 + } + }, + "#score_label": { + "colours": { + "normal_text": "#000000" + }, + "font": { + "size": 20, + "bold": 1 + } } } \ No newline at end of file diff --git a/overcooked_simulator/gui_2d_vis/overcooked_gui.py b/overcooked_simulator/gui_2d_vis/overcooked_gui.py index 89a3acc8..39aa1e7a 100644 --- a/overcooked_simulator/gui_2d_vis/overcooked_gui.py +++ b/overcooked_simulator/gui_2d_vis/overcooked_gui.py @@ -489,9 +489,9 @@ class PyGameGUI: def update_score_label(self, state): score = state["score"] - self.score_label.set_text(f"Your Score is {score}") + self.score_label.set_text(f"Your score is {score}") - def draw_time(self, remaining_time: timedelta): + def update_remaining_time(self, remaining_time: timedelta): hours, rem = divmod(remaining_time.seconds, 3600) minutes, seconds = divmod(rem, 60) display_time = f"{minutes}:{'%02d' % seconds}" @@ -509,7 +509,7 @@ class PyGameGUI: self.draw_counters(state) self.draw_players(state) self.manager.draw_ui(self.main_window) - self.draw_time(state["remaining_time"]) + self.update_remaining_time(state["remaining_time"]) def init_ui_elements(self): self.manager = pygame_gui.UIManager((self.window_width, self.window_height)) @@ -606,7 +606,7 @@ class PyGameGUI: text="GAMETIME", relative_rect=pygame.Rect( (0, 0), - (button_width, button_height), + (button_width * 1.5, button_height), ), manager=self.manager, object_id="#timer_label", @@ -717,13 +717,11 @@ class PyGameGUI: pygame.init() pygame.font.init() - # self.setup_windows() - self.init_ui_elements() - pygame.display.set_caption("Simple Overcooked Simulator") clock = pygame.time.Clock() + self.init_ui_elements() self.manage_button_visibility() # Game loop @@ -736,6 +734,8 @@ class PyGameGUI: for event in pygame.event.get(): if event.type == pygame.QUIT: self.running = False + + # UI Buttons: if event.type == pygame_gui.UI_BUTTON_PRESSED: match event.ui_element: case self.start_button: -- GitLab