diff --git a/cooperative_cuisine/pygame_2d_vis/continue.drawio.png b/cooperative_cuisine/pygame_2d_vis/continue.drawio.png deleted file mode 100644 index 8a249e36fbab58f15550227268228b84d0e58099..0000000000000000000000000000000000000000 Binary files a/cooperative_cuisine/pygame_2d_vis/continue.drawio.png and /dev/null differ diff --git a/cooperative_cuisine/pygame_2d_vis/gui.py b/cooperative_cuisine/pygame_2d_vis/gui.py index 6b4baa868d51e6108995a4eca3228b1047975dc5..e9c9f6c646683db48b51457b7a70dae15035e171 100644 --- a/cooperative_cuisine/pygame_2d_vis/gui.py +++ b/cooperative_cuisine/pygame_2d_vis/gui.py @@ -442,6 +442,8 @@ class PyGameGUI: ROOT_DIR / "pygame_2d_vis" / "gui_theme.json" ) + self.elements_margin = self.window_height * 0.02 + ######################################################################## # All screens ######################################################################## @@ -482,7 +484,7 @@ class PyGameGUI: ) img = pygame.image.load( - ROOT_DIR / "pygame_2d_vis" / "continue.drawio.png" + ROOT_DIR / "pygame_2d_vis" / "gui_images" / "continue_en.png" ).convert_alpha() image_rect = img.get_rect() @@ -505,7 +507,7 @@ class PyGameGUI: (self.window_height // 4), ), ) - player_selection_rect.bottom = -10 + player_selection_rect.bottom = -self.elements_margin self.player_selection_container = pygame_gui.elements.UIPanel( player_selection_rect, manager=self.manager, @@ -634,7 +636,7 @@ class PyGameGUI: ######################################################################## button_rect = pygame.Rect((0, 0), (220, 80)) - button_rect.bottom = -20 + button_rect.bottom = -self.elements_margin self.continue_button = pygame_gui.elements.UIButton( relative_rect=button_rect, text="Continue", @@ -643,7 +645,7 @@ class PyGameGUI: ) image = pygame.image.load( - ROOT_DIR / "pygame_2d_vis" / "tutorial_files" / "tutorial.drawio.png" + ROOT_DIR / "pygame_2d_vis" / "gui_images" / "controls_en.png" ).convert_alpha() image_rect = image.get_rect() img_width = self.window_width * 0.7 @@ -651,9 +653,8 @@ class PyGameGUI: new_dims = (img_width, img_height) image = pygame.transform.scale(image, new_dims) image_rect = image.get_rect() - # image_rect.topleft = (20, self.buttons_height) - # image_rect.topleft = (0, 0) - image_rect.left = self.window_width * 0.01 + image_rect.left = self.elements_margin + image_rect.centery -= self.window_height * 0.075 self.tutorial_image = pygame_gui.elements.UIImage( image_rect, image, @@ -661,41 +662,64 @@ class PyGameGUI: anchors={"centery": "centery", "left": "left"}, ) + arrow_img = pygame.image.load( + ROOT_DIR / "pygame_2d_vis" / "gui_images" / "try_en.png" + ).convert_alpha() + image_rect = arrow_img.get_rect() + img_width = self.window_width * 0.2 + img_height = img_width * (image_rect.height / image_rect.width) + new_dims = (img_width, img_height) + arrow_img = pygame.transform.scale(arrow_img, new_dims) + rect = arrow_img.get_rect() + rect.left = self.window_width * 0.55 + rect.top = self.window_height * 0.7 + self.arrow_img = pygame_gui.elements.UIImage( + relative_rect=rect, + image_surface=arrow_img, + manager=self.manager, + anchors={ + "left": "left", + "top": "top", + }, + ) + rect = pygame.Rect( (0, 0), - (self.window_width * 0.27, self.window_height * 0.3), + (self.window_width * 0.25, self.window_height * 0.4), ) - rect.right = 0 - rect.top = self.window_height * 0.1 + rect.right = -self.elements_margin self.tutorial_recipe_container = pygame_gui.elements.UIPanel( relative_rect=rect, manager=self.manager, object_id="#graph_container", - anchors={"right": "right", "top_target": self.quit_button}, + anchors={"right": "right", "top": "top", "top_target": self.quit_button}, ) self.tutorial_recipe_graph_rect = pygame.Rect( (0, 0), (self.window_width * 0.25, self.window_height * 0.2) ) - # self.tutorial_recipe_graph_rect.bottom = 0 + self.tutorial_recipe_graph_rect.bottom = 0 self.tutorial_graph_image = pygame_gui.elements.UIImage( relative_rect=self.tutorial_recipe_graph_rect, image_surface=pygame.Surface(self.tutorial_recipe_graph_rect.size), manager=self.manager, object_id="#recipe_graph", container=self.tutorial_recipe_container, - anchors={"centerx": "centerx", "top": "top"}, + anchors={"centerx": "centerx", "bottom": "bottom"}, ) - r = pygame.Rect((0, 0), (self.window_width * 0.25, self.buttons_height)) + + r = pygame.Rect((0, 0), (self.window_width * 0.25, self.window_height * 0.05)) r.bottom = 0 text = pygame_gui.elements.UILabel( - text="Try making this recipe:", + text="Salad recipe:", relative_rect=r, manager=self.manager, container=self.tutorial_recipe_container, + object_id="#recipe_name", anchors={ "centerx": "centerx", "bottom": "bottom", + "bottom_target": self.tutorial_graph_image, }, ) @@ -847,23 +871,25 @@ class PyGameGUI: anchors={"center": "center"}, ) - rect = pygame.Rect((0, 0), (-1, -1)) + height = self.window_height * 0.1 + rect = pygame.Rect((0, 0), (self.window_width * 0.9, height)) + rect.centery -= height / 2 text1 = pygame_gui.elements.UILabel( - text="Thank you for participanting in this study :)", + text="Thank you for participating in this study.", relative_rect=rect, manager=self.manager, object_id="#score_label", container=final_text_container, - anchors={"top": "top", "left": "left", "right": "right"}, + anchors={"centery": "centery", "centerx": "centerx"}, ) - rect = pygame.Rect((0, 0), (-1, -1)) + rect = pygame.Rect((0, 0), (self.window_width * 0.9, self.window_height * 0.1)) text2 = pygame_gui.elements.UILabel( - text="Please wait for instructions from the study supervisor.", + text="Please signal the study supervisor that you are ready.", relative_rect=rect, manager=self.manager, object_id="#score_label", container=final_text_container, - anchors={"top_target": text1, "left": "left", "right": "right"}, + anchors={"top_target": text1, "centerx": "centerx"}, ) ######################################################################## @@ -883,6 +909,7 @@ class PyGameGUI: self.quit_button, self.fullscreen_button, self.tutorial_recipe_container, + self.arrow_img, ] self.pregame_screen_elements = [ @@ -947,8 +974,8 @@ class PyGameGUI: max_width=self.window_width * 0.3, ) self.game_center = ( - self.window_width - self.game_width / 2 - (self.window_width * 0.015), - self.window_height - self.game_height / 2 - (self.window_height * 0.015), + self.window_width - self.game_width / 2 - (self.window_height * 0.04), + self.window_height - self.game_height / 2 - (self.window_height * 0.04), ) width, height = self.tutorial_recipe_graph_rect.size @@ -960,7 +987,7 @@ class PyGameGUI: self.level_info["recipe_graphs"][0], width, height, - grid_size=self.window_height / 16, + grid_size=self.window_height / 18, ) self.tutorial_graph_image.set_image(tutorial_graph_surface) # self.tutorial_graph_image.set_dimensions((self.game_width, self.game_height)) diff --git a/cooperative_cuisine/pygame_2d_vis/press_a.drawio.png b/cooperative_cuisine/pygame_2d_vis/press_a.drawio.png deleted file mode 100644 index a79928d56e382d0a78a1dd6890946ef3547a570d..0000000000000000000000000000000000000000 Binary files a/cooperative_cuisine/pygame_2d_vis/press_a.drawio.png and /dev/null differ diff --git a/cooperative_cuisine/pygame_2d_vis/tutorial_files/recipe_mock.png b/cooperative_cuisine/pygame_2d_vis/tutorial_files/recipe_mock.png deleted file mode 100644 index 4ac719852dfd2470712a56ee249f86baa7a891d6..0000000000000000000000000000000000000000 Binary files a/cooperative_cuisine/pygame_2d_vis/tutorial_files/recipe_mock.png and /dev/null differ diff --git a/cooperative_cuisine/pygame_2d_vis/tutorial_files/tutorial.drawio.png b/cooperative_cuisine/pygame_2d_vis/tutorial_files/tutorial.drawio.png deleted file mode 100644 index f4bb6e024e718f003a519e3c7d2e7fc79c65dd8f..0000000000000000000000000000000000000000 Binary files a/cooperative_cuisine/pygame_2d_vis/tutorial_files/tutorial.drawio.png and /dev/null differ