diff --git a/TestV2/ressources/images/Tutorial/Gif1.gif b/TestV2/ressources/images/Tutorial/Gif1.gif index f985094..a224ec2 100644 Binary files a/TestV2/ressources/images/Tutorial/Gif1.gif and b/TestV2/ressources/images/Tutorial/Gif1.gif differ diff --git a/TestV2/ressources/images/Tutorial/Gif2.gif b/TestV2/ressources/images/Tutorial/Gif2.gif index c208dad..2e0a081 100644 Binary files a/TestV2/ressources/images/Tutorial/Gif2.gif and b/TestV2/ressources/images/Tutorial/Gif2.gif differ diff --git a/TestV2/ressources/images/Tutorial/Gif3.gif b/TestV2/ressources/images/Tutorial/Gif3.gif index b951744..e13adc0 100644 Binary files a/TestV2/ressources/images/Tutorial/Gif3.gif and b/TestV2/ressources/images/Tutorial/Gif3.gif differ diff --git a/TestV2/ressources/images/Tutorial/Gif4.gif b/TestV2/ressources/images/Tutorial/Gif4.gif index 512511d..a7a858f 100644 Binary files a/TestV2/ressources/images/Tutorial/Gif4.gif and b/TestV2/ressources/images/Tutorial/Gif4.gif differ diff --git a/TestV2/src/fr/monkhanny/dorfromantik/Main.java b/TestV2/src/fr/monkhanny/dorfromantik/Main.java index 87c616a..b46c168 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/Main.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/Main.java @@ -28,7 +28,7 @@ public class Main { JFrame settingsFrame = new JFrame("Paramètres"); // Créer la fenêtre du tutoriel - JFrame howToPlayFrame = new JFrame("Tutoriel"); + JFrame howToPlayFrame = new JFrame("Comment jouer ?"); // Menu principal MusicPlayer.loadMusic(Musics.MAIN_MENU_MUSIC); diff --git a/TestV2/src/fr/monkhanny/dorfromantik/controller/TutorialController.java b/TestV2/src/fr/monkhanny/dorfromantik/controller/TutorialController.java index 95fab47..5cdfd79 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/controller/TutorialController.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/controller/TutorialController.java @@ -13,10 +13,10 @@ public class TutorialController { public TutorialController() { List steps = new ArrayList<>(); - steps.add(new Step("Étape 1", "Explication de la première étape.", Images.TUTORIAL_GIF1.getImagePath())); - steps.add(new Step("Étape 2", "Explication de la deuxième étape.", Images.TUTORIAL_GIF2.getImagePath())); - steps.add(new Step("Étape 3", "Explication de la troisième étape.", Images.TUTORIAL_GIF3.getImagePath())); - steps.add(new Step("Étape 4", "Explication de la quatrième étape.", Images.TUTORIAL_GIF4.getImagePath())); + steps.add(new Step("Étape n°1", "Explication de la première étape ici.", Images.TUTORIAL_GIF1.getImagePath())); + steps.add(new Step("Étape n°2", "Explication de la deuxième étape ici.", Images.TUTORIAL_GIF2.getImagePath())); + steps.add(new Step("Étape n°3", "Explication de la troisième étape ici.", Images.TUTORIAL_GIF3.getImagePath())); + steps.add(new Step("Étape n°4", "Explication de la quatrième étape ici.", Images.TUTORIAL_GIF4.getImagePath())); tutorialPanel = new TutorialPanel(steps); } diff --git a/TestV2/src/fr/monkhanny/dorfromantik/gui/TutorialPanel.java b/TestV2/src/fr/monkhanny/dorfromantik/gui/TutorialPanel.java index fd8a4a6..c1214e9 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/gui/TutorialPanel.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/gui/TutorialPanel.java @@ -1,7 +1,6 @@ package fr.monkhanny.dorfromantik.gui; import fr.monkhanny.dorfromantik.components.Title; -import fr.monkhanny.dorfromantik.controller.TutorialController; import fr.monkhanny.dorfromantik.gui.Step; import javax.swing.*; @@ -23,54 +22,76 @@ public class TutorialPanel extends JPanel { this.steps = steps; this.currentStepIndex = 0; - // Setup the panel layout + // Utiliser BorderLayout pour la disposition principale setLayout(new BorderLayout()); - // Background setup - setupBackground(); - - // Setup the title - title = new Title("Tutoriel", 70f, Color.BLACK); + // Création du titre centré en haut + title = new Title("Comment jouer ?", 70f, Color.WHITE); + title.setHorizontalAlignment(JLabel.CENTER); + title.setOpaque(false); add(title, BorderLayout.NORTH); - // Step text and image container + // Conteneur principal pour les étapes, centré + JPanel centerPanel = new JPanel(); + centerPanel.setLayout(new GridBagLayout()); + centerPanel.setOpaque(false); // Rendre le conteneur transparent + + // Utiliser GridBagConstraints pour centrer le contenu verticalement + GridBagConstraints gbc = new GridBagConstraints(); + gbc.gridx = 0; + gbc.gridy = 0; + gbc.fill = GridBagConstraints.HORIZONTAL; + gbc.insets = new Insets(10, 0, 10, 0); + + // Conteneur pour le texte et l'image JPanel stepContainer = new JPanel(); - stepContainer.setLayout(new BoxLayout(stepContainer, BoxLayout.Y_AXIS)); // Vertical BoxLayout + stepContainer.setLayout(new BoxLayout(stepContainer, BoxLayout.Y_AXIS)); + stepContainer.setOpaque(false); // Transparent + stepText = new JLabel(); - stepText.setFont(new Font("Arial", Font.PLAIN, 18)); + stepText.setFont(new Font("Arial", Font.BOLD, 28)); stepText.setForeground(Color.WHITE); + stepText.setAlignmentX(Component.CENTER_ALIGNMENT); // Centrer le texte horizontalement + stepImage = new JLabel(); + stepImage.setAlignmentX(Component.CENTER_ALIGNMENT); // Centrer l'image horizontalement - // Center the text and the image - stepText.setAlignmentX(Component.CENTER_ALIGNMENT); // Center the text horizontally - stepImage.setAlignmentX(Component.CENTER_ALIGNMENT); // Center the image horizontally - - // Add components to the stepContainer + // Ajouter les composants au conteneur d'étapes stepContainer.add(stepText); - stepContainer.add(Box.createVerticalStrut(10)); // Optional space between text and image + stepContainer.add(Box.createVerticalStrut(10)); // Espace entre texte et image stepContainer.add(stepImage); - add(stepContainer, BorderLayout.CENTER); - // Navigation buttons + // Ajouter le conteneur d'étapes au centre du panel + centerPanel.add(stepContainer, gbc); + add(centerPanel, BorderLayout.CENTER); + + // Panneau pour les boutons de navigation JPanel buttonPanel = new JPanel(); - buttonPanel.setLayout(new FlowLayout()); + buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); // Centrer les boutons + buttonPanel.setOpaque(false); // Transparent + prevButton = new JButton("Précédent"); nextButton = new JButton("Suivant"); prevButton.addActionListener(e -> showPreviousStep()); nextButton.addActionListener(e -> showNextStep()); buttonPanel.add(prevButton); buttonPanel.add(nextButton); + + // Ajouter le panneau des boutons en bas add(buttonPanel, BorderLayout.SOUTH); - // Initial step display + // Affichage initial de l'étape updateStepDisplay(); } - private void setupBackground() { - JLabel background = new JLabel(new ImageIcon("./ressources/images/MainMenu/backgroundBlured.jpg")); - background.setLayout(null); - background.setBounds(0, 0, getWidth(), getHeight()); - add(background, BorderLayout.CENTER); + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); // Appel à super pour s'assurer que le panneau est dessiné + + // Dessin de l'image de fond pour couvrir tout le panneau + ImageIcon backgroundImage = new ImageIcon("./ressources/images/MainMenu/backgroundBlured.jpg"); + Image image = backgroundImage.getImage(); + g.drawImage(image, 0, 0, getWidth(), getHeight(), this); // Dessiner l'image pour couvrir tout le panneau } private void updateStepDisplay() {