66 lines
2.6 KiB
Java
66 lines
2.6 KiB
Java
package fr.monkhanny.dorfromantik;
|
|
|
|
import fr.monkhanny.dorfromantik.gui.MainMenu;
|
|
import fr.monkhanny.dorfromantik.controller.MainMenuResizeController;
|
|
import fr.monkhanny.dorfromantik.controller.MainMenuButtonController;
|
|
import fr.monkhanny.dorfromantik.utils.MusicPlayer;
|
|
import fr.monkhanny.dorfromantik.enums.Musics;
|
|
import fr.monkhanny.dorfromantik.listeners.CloseWindowListener;
|
|
import fr.monkhanny.dorfromantik.gui.SettingsPanel;
|
|
import fr.monkhanny.dorfromantik.controller.TutorialController;
|
|
import fr.monkhanny.dorfromantik.controller.GameModeController;
|
|
import fr.monkhanny.dorfromantik.gui.GameModeSelectionPanel;
|
|
|
|
|
|
import javax.swing.JFrame;
|
|
|
|
/**
|
|
* Classe principale du jeu
|
|
* @version 1.0
|
|
* @author Moncef STITI
|
|
* @see MainMenu
|
|
* @see MainMenuResizeController
|
|
*/
|
|
public class Main {
|
|
/**
|
|
* Méthode principale du jeu
|
|
* @param args Tableau de String contenant les arguments passé en paramètre au programme
|
|
*/
|
|
public static void main(String[] args) {
|
|
// Créer la fenêtre du jeu
|
|
JFrame gameFrame = new JFrame("Jeu - Dorfromantik");
|
|
|
|
// Créer la fenêtre des paramètres
|
|
JFrame settingsFrame = new JFrame("Paramètres - Dorfromantik");
|
|
|
|
// Créer la fenêtre du tutoriel
|
|
JFrame howToPlayFrame = new JFrame("Comment jouer ? - Dorfromantik");
|
|
|
|
// Menu principal
|
|
MusicPlayer.loadMusic(Musics.MAIN_MENU_MUSIC);
|
|
MusicPlayer.playMusic();
|
|
MainMenu mainMenu = new MainMenu();
|
|
MainMenuResizeController MainMenuResizeController = new MainMenuResizeController(mainMenu);
|
|
MainMenuButtonController MainMenuButtonController = new MainMenuButtonController(mainMenu,settingsFrame,howToPlayFrame,gameFrame);
|
|
|
|
|
|
// Fenêtre des paramètres
|
|
CloseWindowListener settingsWindowListener = new CloseWindowListener(mainMenu, settingsFrame);
|
|
SettingsPanel settingsPanel = new SettingsPanel(mainMenu, settingsFrame);
|
|
settingsFrame.addWindowListener(settingsWindowListener);
|
|
settingsFrame.add(settingsPanel);
|
|
|
|
// Fenêtre du tutoriel
|
|
CloseWindowListener howToPlayWindowListener = new CloseWindowListener(mainMenu, howToPlayFrame);
|
|
TutorialController tutorialController = new TutorialController();
|
|
howToPlayFrame.addWindowListener(howToPlayWindowListener);
|
|
howToPlayFrame.add(tutorialController.getTutorialPanel());
|
|
|
|
// Fenêtre du choix des modes de jeu
|
|
GameModeController gameModeController = new GameModeController();
|
|
GameModeSelectionPanel gameModeSelectionPanel = new GameModeSelectionPanel(gameModeController);
|
|
gameModeController.setGameModeSelectionPanel(gameModeSelectionPanel);
|
|
gameFrame.add(gameModeSelectionPanel);
|
|
}
|
|
}
|