diff --git a/TestV2/libs/mariadb-client.jar b/TestV2/libs/mariadb-client.jar new file mode 100644 index 0000000..f18798b Binary files /dev/null and b/TestV2/libs/mariadb-client.jar differ diff --git a/TestV2/src/fr/monkhanny/dorfromantik/Options.java b/TestV2/src/fr/monkhanny/dorfromantik/Options.java index 72b9750..187fee1 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/Options.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/Options.java @@ -55,4 +55,6 @@ public class Options { public static boolean AUTO_FOCUS = true; public static final int MAX_TILE_NUMBER = 50; + + public static boolean FULL_SCREEN = false; } diff --git a/TestV2/src/fr/monkhanny/dorfromantik/controller/MainMenuButtonController.java b/TestV2/src/fr/monkhanny/dorfromantik/controller/MainMenuButtonController.java index 91aed84..75cd488 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/controller/MainMenuButtonController.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/controller/MainMenuButtonController.java @@ -35,30 +35,31 @@ public class MainMenuButtonController implements ActionListener { // Paramètrage de la fenêtre des paramètres this.settingsFrame = settingsFrame; - this.settingsFrame.setLocationRelativeTo(null); - this.settingsFrame.setVisible(false); - this.settingsFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + configureFrame(settingsFrame); // Paramètrage de la fenêtre du tutoriel this.howToPlayFrame = howToPlayFrame; - this.howToPlayFrame.setLocationRelativeTo(null); - this.howToPlayFrame.setVisible(false); - this.howToPlayFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + configureFrame(howToPlayFrame); + // Paramètrage de la fenêtre du jeu this.gameModeFrame = gameModeFrame; - this.gameModeFrame.setLocationRelativeTo(null); - this.gameModeFrame.setVisible(false); - this.gameModeFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + configureFrame(gameModeFrame); + // Paramètrage de la fenêtre du jeu this.gameFrame = gameFrame; - this.gameFrame.setLocationRelativeTo(null); - this.gameFrame.setVisible(false); - this.gameFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + configureFrame(gameFrame); } + private void configureFrame(JFrame frame) { + frame.setLocationRelativeTo(null); + frame.setVisible(false); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + } + + @Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); @@ -86,21 +87,8 @@ public class MainMenuButtonController implements ActionListener { } public void startNewGame() { - // Récupérer la taille et la position de la fenêtre du menu principal - Dimension mainMenuSize = this.mainMenu.getSize(); - Point mainMenuLocation = this.mainMenu.getLocation(); - - // Ajuster la fenêtre des paramètres pour qu'elle ait la même taille et position - this.gameModeFrame.setSize(mainMenuSize); - this.gameModeFrame.setLocation(mainMenuLocation); - - this.gameFrame.setSize(mainMenuSize); - this.gameFrame.setLocation(mainMenuLocation); - - // Cacher la fenêtre du menu principal + adjustFrameDisplay(this.gameModeFrame); this.mainMenu.setVisible(false); - - // Afficher la fenêtre des paramètres this.gameModeFrame.setVisible(true); } @@ -110,18 +98,8 @@ public class MainMenuButtonController implements ActionListener { } public void showHowToPlay() { - // Récupérer la taille et la position de la fenêtre du menu principal - Dimension mainMenuSize = this.mainMenu.getSize(); - Point mainMenuLocation = this.mainMenu.getLocation(); - - // Ajuster la fenêtre des paramètres pour qu'elle ait la même taille et position - this.howToPlayFrame.setSize(mainMenuSize); - this.howToPlayFrame.setLocation(mainMenuLocation); - - // Cacher la fenêtre du menu principal + adjustFrameDisplay(this.howToPlayFrame); this.mainMenu.setVisible(false); - - // Afficher la fenêtre des paramètres this.howToPlayFrame.setVisible(true); } @@ -131,18 +109,23 @@ public class MainMenuButtonController implements ActionListener { } private void openSettings() { - // Récupérer la taille et la position de la fenêtre du menu principal - Dimension mainMenuSize = this.mainMenu.getSize(); - Point mainMenuLocation = this.mainMenu.getLocation(); - - // Ajuster la fenêtre des paramètres pour qu'elle ait la même taille et position - this.settingsFrame.setSize(mainMenuSize); - this.settingsFrame.setLocation(mainMenuLocation); - - // Cacher la fenêtre du menu principal + adjustFrameDisplay(this.settingsFrame); this.mainMenu.setVisible(false); - - // Afficher la fenêtre des paramètres this.settingsFrame.setVisible(true); } + + + private void adjustFrameDisplay(JFrame frame) { + if (Options.FULL_SCREEN) { + frame.setExtendedState(JFrame.MAXIMIZED_BOTH); // Mettre la fenêtre en plein écran + frame.setUndecorated(true); // Retirer la décoration de la fenêtre + } else { + // Récupérer la taille et la position de la fenêtre du menu principal + Dimension mainMenuSize = this.mainMenu.getSize(); + Point mainMenuLocation = this.mainMenu.getLocation(); + frame.setSize(mainMenuSize); + frame.setLocation(mainMenuLocation); + frame.setUndecorated(false); // Restaurer la décoration si nécessaire + } + } }