Skip to content
Snippets Groups Projects
Commit 3d2be0fc authored by Fabian Heinrich's avatar Fabian Heinrich
Browse files

Actually fixed quit button. Did not quit because threads were started but never stopped.

parent 309d77c7
No related branches found
No related tags found
1 merge request!23Resolve "Game menus start and end"
Pipeline #43006 passed
radius: 0.4 radius: 0.4
move_dist: 0.2 move_dist: 0.12
interaction_range: 1.6 interaction_range: 1.6
\ No newline at end of file
...@@ -96,7 +96,7 @@ class PyGameGUI: ...@@ -96,7 +96,7 @@ class PyGameGUI:
): ):
self.game_screen = None self.game_screen = None
self.FPS = 60 self.FPS = 60
self.simulator = simulator self.simulator: Simulator = simulator
self.player_names = player_names self.player_names = player_names
self.player_keys = player_keys self.player_keys = player_keys
...@@ -579,6 +579,7 @@ class PyGameGUI: ...@@ -579,6 +579,7 @@ class PyGameGUI:
self.simulator.start() self.simulator.start()
def change_to_start_window(self): def change_to_start_window(self):
self.simulator.stop()
self.menu_state = MenuStates.Start self.menu_state = MenuStates.Start
self.back_button.hide() self.back_button.hide()
self.quit_button.show() self.quit_button.show()
...@@ -604,6 +605,7 @@ class PyGameGUI: ...@@ -604,6 +605,7 @@ class PyGameGUI:
self.setup_simulation(config_path, layout_path) self.setup_simulation(config_path, layout_path)
def change_to_end_window(self): def change_to_end_window(self):
self.simulator.stop()
self.menu_state = MenuStates.End self.menu_state = MenuStates.End
self.start_button.hide() self.start_button.hide()
self.back_button.show() self.back_button.show()
...@@ -686,8 +688,8 @@ class PyGameGUI: ...@@ -686,8 +688,8 @@ class PyGameGUI:
game_screen_rect = self.game_screen.get_rect() game_screen_rect = self.game_screen.get_rect()
game_screen_rect.center = [ game_screen_rect.center = [
(self.window_width) // 2, self.window_width // 2,
(self.window_height) // 2, self.window_height // 2,
] ]
self.main_window.blit(self.game_screen, game_screen_rect) self.main_window.blit(self.game_screen, game_screen_rect)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment