Amélioration du jeu

This commit is contained in:
2024-11-24 15:54:57 +01:00
parent fd8004bb8a
commit 29d3dd946d
4 changed files with 15 additions and 11 deletions

View File

@@ -53,7 +53,7 @@ public class Options {
public static final Dimension MINIMUM_FRAME_SIZE = new Dimension(700, 700); public static final Dimension MINIMUM_FRAME_SIZE = new Dimension(700, 700);
public static boolean AUTO_FOCUS = true; public static boolean AUTO_FOCUS = false;
public static final int MAX_TILE_NUMBER = 50; public static final int MAX_TILE_NUMBER = 50;

View File

@@ -96,7 +96,7 @@ public class GameOver extends JPanel {
groupPanel.setOpaque(false); groupPanel.setOpaque(false);
groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.Y_AXIS)); groupPanel.setLayout(new BoxLayout(groupPanel, BoxLayout.Y_AXIS));
JLabel groupTitleLabel = new JLabel("Vous êtes dans le groupe " + playerGroup + " !"); JLabel groupTitleLabel = new JLabel("Vous êtes dans le groupe " + playerGroup + "/10 !");
groupTitleLabel.setFont(Fonts.SCORE.getFont(24)); groupTitleLabel.setFont(Fonts.SCORE.getFont(24));
groupTitleLabel.setForeground(Color.WHITE); groupTitleLabel.setForeground(Color.WHITE);
groupTitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT); groupTitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT);

View File

@@ -158,7 +158,7 @@ public class SettingsPanel extends JPanel {
checkBoxPanel.setOpaque(false); // Assurer que le fond est transparent checkBoxPanel.setOpaque(false); // Assurer que le fond est transparent
// Texte explicatif avant la case à cocher // Texte explicatif avant la case à cocher
JLabel descriptionLabel = new JLabel("Gestion du focus automatique :"); JLabel descriptionLabel = new JLabel("Gestion du focus automatique (nécessite une bonne carte graphique) :");
descriptionLabel.setFont(new Font("Roboto", Font.PLAIN, 18)); descriptionLabel.setFont(new Font("Roboto", Font.PLAIN, 18));
descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT); // Aligner à gauche descriptionLabel.setAlignmentX(Component.LEFT_ALIGNMENT); // Aligner à gauche
checkBoxPanel.add(descriptionLabel); // Ajouter le texte dans le panneau checkBoxPanel.add(descriptionLabel); // Ajouter le texte dans le panneau

View File

@@ -36,14 +36,18 @@ public class TilePanningActionListener implements ActionListener {
board.setOffsetY(targetOffsetY); board.setOffsetY(targetOffsetY);
stopAnimation(); stopAnimation();
} else { } else {
// Calculer le delta pour chaque étape // Calculer le delta pour chaque étape en utilisant des valeurs flottantes
int deltaX = (targetOffsetX - currentOffsetX) / (steps - currentStep); float deltaX = (float)(targetOffsetX - currentOffsetX) / (steps - currentStep);
int deltaY = (targetOffsetY - currentOffsetY) / (steps - currentStep); float deltaY = (float)(targetOffsetY - currentOffsetY) / (steps - currentStep);
// Appliquer la transition progressivement // Appliquer la transition progressivement avec un arrondi à l'entier le plus proche
board.setOffsetX(currentOffsetX + deltaX); board.setOffsetX(currentOffsetX + Math.round(deltaX));
board.setOffsetY(currentOffsetY + deltaY); board.setOffsetY(currentOffsetY + Math.round(deltaY));
// Ne redessiner que si nécessaire
if (currentStep % 2 == 0) { // Par exemple, redessiner toutes les 2 étapes
board.repaint(); // Re-dessiner le plateau board.repaint(); // Re-dessiner le plateau
}
// Augmenter le compteur d'étapes // Augmenter le compteur d'étapes
currentStep++; currentStep++;