Modifica la gestione del ritardo nella classe GameWindow e ripristina l'uso di subprocess per la riproduzione audio in MiceMaze

This commit is contained in:
2024-12-22 18:54:26 +01:00
parent 8cffd7591a
commit f20e789d80
2 changed files with 4 additions and 2 deletions
+2
View File
@@ -134,6 +134,8 @@ class GameWindow:
self.performance = (sdl2.SDL_GetPerformanceCounter() - performance_start) / sdl2.SDL_GetPerformanceFrequency() * 1000
if self.performance < self.delay:
delay = self.delay - round(self.performance)
else:
delay = 0
sdl2.SDL_Delay(delay)
def close(self):
+2 -2
View File
@@ -89,8 +89,8 @@ class MiceMaze(controls.KeyBindings):
def play_sound(self, sound_file):
if self.audio:
#subprocess.Popen(["aplay", f"sound/{sound_file}"])
self.engine.play_sound(f"sound/{sound_file}")
subprocess.Popen(["aplay", f"sound/{sound_file}"])
#self.engine.play_sound(f"sound/{sound_file}")
def graphics_load(self):
self.tunnel = self.engine.load_image("Rat/BMP_TUNNEL.png")