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:
@@ -134,6 +134,8 @@ class GameWindow:
|
|||||||
self.performance = (sdl2.SDL_GetPerformanceCounter() - performance_start) / sdl2.SDL_GetPerformanceFrequency() * 1000
|
self.performance = (sdl2.SDL_GetPerformanceCounter() - performance_start) / sdl2.SDL_GetPerformanceFrequency() * 1000
|
||||||
if self.performance < self.delay:
|
if self.performance < self.delay:
|
||||||
delay = self.delay - round(self.performance)
|
delay = self.delay - round(self.performance)
|
||||||
|
else:
|
||||||
|
delay = 0
|
||||||
sdl2.SDL_Delay(delay)
|
sdl2.SDL_Delay(delay)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ class MiceMaze(controls.KeyBindings):
|
|||||||
|
|
||||||
def play_sound(self, sound_file):
|
def play_sound(self, sound_file):
|
||||||
if self.audio:
|
if self.audio:
|
||||||
#subprocess.Popen(["aplay", f"sound/{sound_file}"])
|
subprocess.Popen(["aplay", f"sound/{sound_file}"])
|
||||||
self.engine.play_sound(f"sound/{sound_file}")
|
#self.engine.play_sound(f"sound/{sound_file}")
|
||||||
|
|
||||||
def graphics_load(self):
|
def graphics_load(self):
|
||||||
self.tunnel = self.engine.load_image("Rat/BMP_TUNNEL.png")
|
self.tunnel = self.engine.load_image("Rat/BMP_TUNNEL.png")
|
||||||
|
|||||||
Reference in New Issue
Block a user