From 29d3dd946df29b95142528077d7fb05cd3c5a850 Mon Sep 17 00:00:00 2001 From: Moncef STITI Date: Sun, 24 Nov 2024 15:54:57 +0100 Subject: [PATCH] =?UTF-8?q?Am=C3=A9lioration=20du=20jeu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/monkhanny/dorfromantik/Options.java | 2 +- .../monkhanny/dorfromantik/game/GameOver.java | 2 +- .../dorfromantik/gui/SettingsPanel.java | 2 +- .../listeners/TilePanningActionListener.java | 20 +++++++++++-------- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/TestV2/src/fr/monkhanny/dorfromantik/Options.java b/TestV2/src/fr/monkhanny/dorfromantik/Options.java index c9c8fa0..cdc2523 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/Options.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/Options.java @@ -53,7 +53,7 @@ public class Options { 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; diff --git a/TestV2/src/fr/monkhanny/dorfromantik/game/GameOver.java b/TestV2/src/fr/monkhanny/dorfromantik/game/GameOver.java index 42bf226..0e2853b 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/game/GameOver.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/game/GameOver.java @@ -96,7 +96,7 @@ public class GameOver extends JPanel { groupPanel.setOpaque(false); 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.setForeground(Color.WHITE); groupTitleLabel.setAlignmentX(Component.CENTER_ALIGNMENT); diff --git a/TestV2/src/fr/monkhanny/dorfromantik/gui/SettingsPanel.java b/TestV2/src/fr/monkhanny/dorfromantik/gui/SettingsPanel.java index fc17d3a..3d7cedc 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/gui/SettingsPanel.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/gui/SettingsPanel.java @@ -158,7 +158,7 @@ public class SettingsPanel extends JPanel { checkBoxPanel.setOpaque(false); // Assurer que le fond est transparent // 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.setAlignmentX(Component.LEFT_ALIGNMENT); // Aligner à gauche checkBoxPanel.add(descriptionLabel); // Ajouter le texte dans le panneau diff --git a/TestV2/src/fr/monkhanny/dorfromantik/listeners/TilePanningActionListener.java b/TestV2/src/fr/monkhanny/dorfromantik/listeners/TilePanningActionListener.java index 00b77cf..81d49f6 100644 --- a/TestV2/src/fr/monkhanny/dorfromantik/listeners/TilePanningActionListener.java +++ b/TestV2/src/fr/monkhanny/dorfromantik/listeners/TilePanningActionListener.java @@ -14,7 +14,7 @@ public class TilePanningActionListener implements ActionListener { // Indicateur pour vérifier si l'animation est en cours private static boolean isAnimating = false; - + // Variables pour suivre l'état de l'animation private int currentStep = 0; @@ -36,14 +36,18 @@ public class TilePanningActionListener implements ActionListener { board.setOffsetY(targetOffsetY); stopAnimation(); } else { - // Calculer le delta pour chaque étape - int deltaX = (targetOffsetX - currentOffsetX) / (steps - currentStep); - int deltaY = (targetOffsetY - currentOffsetY) / (steps - currentStep); + // Calculer le delta pour chaque étape en utilisant des valeurs flottantes + float deltaX = (float)(targetOffsetX - currentOffsetX) / (steps - currentStep); + float deltaY = (float)(targetOffsetY - currentOffsetY) / (steps - currentStep); - // Appliquer la transition progressivement - board.setOffsetX(currentOffsetX + deltaX); - board.setOffsetY(currentOffsetY + deltaY); - board.repaint(); // Re-dessiner le plateau + // Appliquer la transition progressivement avec un arrondi à l'entier le plus proche + board.setOffsetX(currentOffsetX + Math.round(deltaX)); + 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 + } // Augmenter le compteur d'étapes currentStep++;