Correction de l'arrière plan dans comment jouer.
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 888 KiB |
Before Width: | Height: | Size: 486 KiB After Width: | Height: | Size: 1.9 MiB |
@@ -28,7 +28,7 @@ public class Main {
|
|||||||
JFrame settingsFrame = new JFrame("Paramètres");
|
JFrame settingsFrame = new JFrame("Paramètres");
|
||||||
|
|
||||||
// Créer la fenêtre du tutoriel
|
// Créer la fenêtre du tutoriel
|
||||||
JFrame howToPlayFrame = new JFrame("Tutoriel");
|
JFrame howToPlayFrame = new JFrame("Comment jouer ?");
|
||||||
|
|
||||||
// Menu principal
|
// Menu principal
|
||||||
MusicPlayer.loadMusic(Musics.MAIN_MENU_MUSIC);
|
MusicPlayer.loadMusic(Musics.MAIN_MENU_MUSIC);
|
||||||
|
@@ -13,10 +13,10 @@ public class TutorialController {
|
|||||||
|
|
||||||
public TutorialController() {
|
public TutorialController() {
|
||||||
List<Step> steps = new ArrayList<>();
|
List<Step> steps = new ArrayList<>();
|
||||||
steps.add(new Step("Étape 1", "Explication de la première étape.", Images.TUTORIAL_GIF1.getImagePath()));
|
steps.add(new Step("Étape n°1", "Explication de la première étape ici.", 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 n°2", "Explication de la deuxième étape ici.", 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 n°3", "Explication de la troisième étape ici.", 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°4", "Explication de la quatrième étape ici.", Images.TUTORIAL_GIF4.getImagePath()));
|
||||||
|
|
||||||
tutorialPanel = new TutorialPanel(steps);
|
tutorialPanel = new TutorialPanel(steps);
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package fr.monkhanny.dorfromantik.gui;
|
package fr.monkhanny.dorfromantik.gui;
|
||||||
|
|
||||||
import fr.monkhanny.dorfromantik.components.Title;
|
import fr.monkhanny.dorfromantik.components.Title;
|
||||||
import fr.monkhanny.dorfromantik.controller.TutorialController;
|
|
||||||
import fr.monkhanny.dorfromantik.gui.Step;
|
import fr.monkhanny.dorfromantik.gui.Step;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -23,54 +22,76 @@ public class TutorialPanel extends JPanel {
|
|||||||
this.steps = steps;
|
this.steps = steps;
|
||||||
this.currentStepIndex = 0;
|
this.currentStepIndex = 0;
|
||||||
|
|
||||||
// Setup the panel layout
|
// Utiliser BorderLayout pour la disposition principale
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
// Background setup
|
// Création du titre centré en haut
|
||||||
setupBackground();
|
title = new Title("Comment jouer ?", 70f, Color.WHITE);
|
||||||
|
title.setHorizontalAlignment(JLabel.CENTER);
|
||||||
// Setup the title
|
title.setOpaque(false);
|
||||||
title = new Title("Tutoriel", 70f, Color.BLACK);
|
|
||||||
add(title, BorderLayout.NORTH);
|
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();
|
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 = new JLabel();
|
||||||
stepText.setFont(new Font("Arial", Font.PLAIN, 18));
|
stepText.setFont(new Font("Arial", Font.BOLD, 28));
|
||||||
stepText.setForeground(Color.WHITE);
|
stepText.setForeground(Color.WHITE);
|
||||||
|
stepText.setAlignmentX(Component.CENTER_ALIGNMENT); // Centrer le texte horizontalement
|
||||||
|
|
||||||
stepImage = new JLabel();
|
stepImage = new JLabel();
|
||||||
|
stepImage.setAlignmentX(Component.CENTER_ALIGNMENT); // Centrer l'image horizontalement
|
||||||
|
|
||||||
// Center the text and the image
|
// Ajouter les composants au conteneur d'étapes
|
||||||
stepText.setAlignmentX(Component.CENTER_ALIGNMENT); // Center the text horizontally
|
|
||||||
stepImage.setAlignmentX(Component.CENTER_ALIGNMENT); // Center the image horizontally
|
|
||||||
|
|
||||||
// Add components to the stepContainer
|
|
||||||
stepContainer.add(stepText);
|
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);
|
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();
|
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");
|
prevButton = new JButton("Précédent");
|
||||||
nextButton = new JButton("Suivant");
|
nextButton = new JButton("Suivant");
|
||||||
prevButton.addActionListener(e -> showPreviousStep());
|
prevButton.addActionListener(e -> showPreviousStep());
|
||||||
nextButton.addActionListener(e -> showNextStep());
|
nextButton.addActionListener(e -> showNextStep());
|
||||||
buttonPanel.add(prevButton);
|
buttonPanel.add(prevButton);
|
||||||
buttonPanel.add(nextButton);
|
buttonPanel.add(nextButton);
|
||||||
|
|
||||||
|
// Ajouter le panneau des boutons en bas
|
||||||
add(buttonPanel, BorderLayout.SOUTH);
|
add(buttonPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
// Initial step display
|
// Affichage initial de l'étape
|
||||||
updateStepDisplay();
|
updateStepDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupBackground() {
|
@Override
|
||||||
JLabel background = new JLabel(new ImageIcon("./ressources/images/MainMenu/backgroundBlured.jpg"));
|
protected void paintComponent(Graphics g) {
|
||||||
background.setLayout(null);
|
super.paintComponent(g); // Appel à super pour s'assurer que le panneau est dessiné
|
||||||
background.setBounds(0, 0, getWidth(), getHeight());
|
|
||||||
add(background, BorderLayout.CENTER);
|
// 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() {
|
private void updateStepDisplay() {
|
||||||
|