Skip to content
Snippets Groups Projects
Commit 2dbface9 authored by fheinrich's avatar fheinrich
Browse files

Use timedelta instead of fixed fps for actions, relevant when using fullscreen in 4k

parent 150c4f6b
No related branches found
No related tags found
1 merge request!55Resolve "Second window"
Pipeline #45930 passed
......@@ -250,7 +250,7 @@ class PyGameGUI:
current_player_name,
ActionType.MOVEMENT,
move_vec,
duration=1 / self.FPS,
duration=1 / self.time_delta, # TODO use fps of previous clock step
)
self.send_action(action)
......@@ -1031,8 +1031,10 @@ class PyGameGUI:
self.running = True
while self.running:
try:
time_delta = clock.tick(self.FPS) / 1000.0
self.time_delta = clock.tick(self.FPS) / 1000.0
# print(clock.get_time())
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.running = False
......@@ -1159,7 +1161,7 @@ class PyGameGUI:
case MenuStates.End:
self.update_conclusion_label(state)
self.manager.update(time_delta)
self.manager.update(self.time_delta)
pygame.display.flip()
except (KeyboardInterrupt, SystemExit):
......
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