moved the load_option code from main to GameWindow
This commit is contained in:
parent
9fe42e16ec
commit
f1edbeb8ac
2 changed files with 5 additions and 4 deletions
4
main.pyw
4
main.pyw
|
@ -27,9 +27,5 @@ except: pass # NOQA E722
|
||||||
window.set_minimum_size(720, 480)
|
window.set_minimum_size(720, 480)
|
||||||
window.add_scene(MainMenu)
|
window.add_scene(MainMenu)
|
||||||
|
|
||||||
# Créer un événement juste après le debut de la boucle pour charger les options.
|
|
||||||
# Puisque pyglet.app.run va limiter les FPS à 60, les options doivent être chargées juste après
|
|
||||||
# afin que les anciens paramètres de FPS soient appliqués.
|
|
||||||
pyglet.clock.schedule_once(lambda *_: window.load_option(), 0)
|
|
||||||
# Démarre la boucle d'événement
|
# Démarre la boucle d'événement
|
||||||
pyglet.app.run()
|
pyglet.app.run()
|
||||||
|
|
|
@ -28,6 +28,11 @@ class GameWindow(Window): # NOQA
|
||||||
self.option = None
|
self.option = None
|
||||||
self.option_path = option_path
|
self.option_path = option_path
|
||||||
|
|
||||||
|
# Créer un événement juste après le debut de la boucle pour charger les options.
|
||||||
|
# Puisque pyglet.app.run va limiter les FPS à 60, les options doivent être chargées juste après
|
||||||
|
# afin que les anciens paramètres de FPS soient appliqués.
|
||||||
|
pyglet.clock.schedule_once(lambda *_: self.load_option(), 0)
|
||||||
|
|
||||||
def load_option(self):
|
def load_option(self):
|
||||||
try:
|
try:
|
||||||
if self.option_path.exists():
|
if self.option_path.exists():
|
||||||
|
|
Loading…
Reference in a new issue