Modification temporaire - Correction du bug de taille des boutons

This commit is contained in:
2024-11-10 20:19:32 +01:00
parent 5f2be94343
commit 2a1bef990b
3 changed files with 20 additions and 3 deletions

View File

@@ -2,9 +2,11 @@ package fr.monkhanny.dorfromantik.controller;
import fr.monkhanny.dorfromantik.gui.MainMenu;
import fr.monkhanny.dorfromantik.Options;
import fr.monkhanny.dorfromantik.gui.ButtonHoverAnimator;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JButton;
public class MainMenuResizeHandler extends ComponentAdapter {
@@ -16,11 +18,14 @@ public class MainMenuResizeHandler extends ComponentAdapter {
@Override
public void componentResized(ComponentEvent e) {
int mainMenuWidth = mainMenu.getWidth();
// Ajuster la taille de la police du titre en fonction de la taille de la fenêtre
float newFontSize = Options.BASE_TITLE_FONT_SIZE * (mainMenu.getWidth() / 900f);
float newFontSize = Options.BASE_TITLE_FONT_SIZE * (mainMenuWidth / 900f);
mainMenu.getTitleLabel().updateTitleFont(newFontSize);
// Mettre à jour les polices des boutons
mainMenu.getButtonPanel().updateButtonFonts(mainMenu.getWidth());
mainMenu.getButtonPanel().updateButtonFonts(mainMenuWidth);
ButtonHoverAnimator.updateOriginalFont(mainMenuWidth / 30f); // On passe la nouvelle taille de police pour chaque bouton
}
}