Ajouts de music de fond + modification des boutons (quand on survole le bouton, sa taille grandis progressivement et la couleur change
This commit is contained in:
@@ -2,6 +2,7 @@ package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import fr.monkhanny.dorfromantik.utils.FontManager;
|
||||
import fr.monkhanny.dorfromantik.components.Button;
|
||||
import fr.monkhanny.dorfromantik.controller.MainMenuMouseController;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -11,6 +12,8 @@ public class ButtonPanel extends JPanel {
|
||||
private JButton newGameButton;
|
||||
private JButton continueGameButton;
|
||||
private JButton howToPlayButton;
|
||||
private JButton settingsButton;
|
||||
private JButton exitButton;
|
||||
|
||||
public ButtonPanel(float fontSize) {
|
||||
// Paramétrage de l'apparence du panneau
|
||||
@@ -22,9 +25,11 @@ public class ButtonPanel extends JPanel {
|
||||
this.add(Box.createVerticalGlue());
|
||||
|
||||
// Créer les boutons avec un style personnalisé
|
||||
newGameButton = Button.createStyledButton("Nouvelle partie", fontSize);
|
||||
continueGameButton = Button.createStyledButton("Continuer une partie", fontSize);
|
||||
howToPlayButton = Button.createStyledButton("Comment jouer ?", fontSize);
|
||||
newGameButton = Button.createCustomTextButton("Nouvelle partie", fontSize);
|
||||
continueGameButton = Button.createCustomTextButton("Continuer une partie", fontSize);
|
||||
howToPlayButton = Button.createCustomTextButton("Comment jouer ?", fontSize);
|
||||
settingsButton = Button.createCustomTextButton("Paramètres", fontSize);
|
||||
exitButton = Button.createCustomTextButton("Quitter", fontSize);
|
||||
|
||||
// Ajouter les boutons au panneau
|
||||
this.add(newGameButton);
|
||||
@@ -32,9 +37,15 @@ public class ButtonPanel extends JPanel {
|
||||
this.add(continueGameButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(howToPlayButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(settingsButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(exitButton);
|
||||
|
||||
// Espacement extensible pour maintenir les icônes en bas
|
||||
this.add(Box.createVerticalGlue());
|
||||
|
||||
MainMenuMouseController gestionSouris = new MainMenuMouseController(this);
|
||||
}
|
||||
|
||||
public JButton getNewGameButton() {
|
||||
@@ -49,11 +60,21 @@ public class ButtonPanel extends JPanel {
|
||||
return howToPlayButton;
|
||||
}
|
||||
|
||||
public JButton getSettingsButton() {
|
||||
return settingsButton;
|
||||
}
|
||||
|
||||
public JButton getExitButton() {
|
||||
return exitButton;
|
||||
}
|
||||
|
||||
public void updateButtonFonts(int windowWidth) {
|
||||
// Mettre à jour la police des boutons avec la taille ajustée
|
||||
float newFontSize = windowWidth / 30f;
|
||||
newGameButton.setFont(FontManager.getTitleFont(newFontSize));
|
||||
continueGameButton.setFont(FontManager.getTitleFont(newFontSize));
|
||||
howToPlayButton.setFont(FontManager.getTitleFont(newFontSize));
|
||||
settingsButton.setFont(FontManager.getTitleFont(newFontSize));
|
||||
exitButton.setFont(FontManager.getTitleFont(newFontSize));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user