Correction de l'arrière plan dans comment jouer.

This commit is contained in:
2024-11-13 20:41:55 +01:00
parent b3d49aea11
commit 6551875575
7 changed files with 51 additions and 30 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 888 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 KiB

After

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -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);

View File

@@ -13,10 +13,10 @@ public class TutorialController {
public TutorialController() {
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 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 1", "Explication de la première étape ici.", Images.TUTORIAL_GIF1.getImagePath()));
steps.add(new Step("Étape 2", "Explication de la deuxième étape ici.", Images.TUTORIAL_GIF2.getImagePath()));
steps.add(new Step("Étape 3", "Explication de la troisième étape ici.", Images.TUTORIAL_GIF3.getImagePath()));
steps.add(new Step("Étape 4", "Explication de la quatrième étape ici.", Images.TUTORIAL_GIF4.getImagePath()));
tutorialPanel = new TutorialPanel(steps);
}

View File

@@ -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() {