Amélioration

This commit is contained in:
2024-12-05 17:58:50 +01:00
parent 25d43b6c3d
commit ffaa6d8ed7
2 changed files with 15 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package fr.monkhanny.dorfromantik.game; package fr.monkhanny.dorfromantik.game;
import fr.monkhanny.dorfromantik.Options; import fr.monkhanny.dorfromantik.Options;
import fr.monkhanny.dorfromantik.listeners.EscapeMenuCloseListener;
import fr.monkhanny.dorfromantik.listeners.GameQuitButtonListener; import fr.monkhanny.dorfromantik.listeners.GameQuitButtonListener;
import fr.monkhanny.dorfromantik.listeners.GameResumeButtonListener; import fr.monkhanny.dorfromantik.listeners.GameResumeButtonListener;
import fr.monkhanny.dorfromantik.listeners.GameSettingsButtonListener; import fr.monkhanny.dorfromantik.listeners.GameSettingsButtonListener;
@@ -23,6 +24,7 @@ public class PauseGame extends KeyAdapter {
this.resumeButtonListener = new GameResumeButtonListener(this.escapeMenu); this.resumeButtonListener = new GameResumeButtonListener(this.escapeMenu);
this.quitButtonListener = new GameQuitButtonListener();; // Initialisé après la création de escapeMenu this.quitButtonListener = new GameQuitButtonListener();; // Initialisé après la création de escapeMenu
this.settingsButtonListener = new GameSettingsButtonListener(gameFrame, this.escapeMenu); // Passer escapeMenu correctement this.settingsButtonListener = new GameSettingsButtonListener(gameFrame, this.escapeMenu); // Passer escapeMenu correctement
this.escapeMenu.addWindowListener(new EscapeMenuCloseListener());
} }
@Override @Override

View File

@@ -0,0 +1,13 @@
package fr.monkhanny.dorfromantik.listeners;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import fr.monkhanny.dorfromantik.Options;
public class EscapeMenuCloseListener extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
Options.isPaused = false;
}
}