mirror of
https://forge.univ-lyon1.fr/tplifap4/gyromite_ya.git
synced 2024-02-27 13:31:49 +01:00
Pas grand choses
This commit is contained in:
parent
acda315a08
commit
f05bd67d8f
BIN
Images/Bombe.png
Normal file
BIN
Images/Bombe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 758 B |
BIN
Images/Corde.png
Normal file
BIN
Images/Corde.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 B |
@ -36,6 +36,7 @@ public class VueControleurGyromite extends JFrame implements Observer {
|
||||
private ImageIcon icoMur;
|
||||
private ImageIcon icoColonne;
|
||||
private ImageIcon icoCorde;
|
||||
private ImageIcon icoBombe;
|
||||
|
||||
private JLabel[][] tabJLabel; // cases graphique (au moment du rafraichissement, chaque case va être associée à une icône, suivant ce qui est présent dans le modèle)
|
||||
|
||||
@ -71,6 +72,7 @@ public class VueControleurGyromite extends JFrame implements Observer {
|
||||
icoColonne = chargerIcone("Images/Colonne.png");
|
||||
icoMur = chargerIcone("Images/Mur.png");
|
||||
icoCorde = chargerIcone("Images/Corde.png");
|
||||
icoBombe = chargerIcone("Images/Bombe.png");
|
||||
}
|
||||
|
||||
private ImageIcon chargerIcone(String urlIcone) {
|
||||
@ -112,18 +114,21 @@ public class VueControleurGyromite extends JFrame implements Observer {
|
||||
private void mettreAJourAffichage() {
|
||||
for (int x = 0; x < sizeX; x++) {
|
||||
for (int y = 0; y < sizeY; y++) {
|
||||
if (jeu.getGrille()[x][y][0] instanceof Heros) { // si la grille du modèle contient un Pacman, on associe l'icône Pacman du côté de la vue
|
||||
// System.out.println("Héros !");
|
||||
tabJLabel[x][y].setIcon(icoHero);
|
||||
} else if (jeu.getGrille()[x][y][0] instanceof Mur) {
|
||||
tabJLabel[x][y].setIcon(icoMur);
|
||||
} else if (jeu.getGrille()[x][y][0] instanceof Colonne) {
|
||||
tabJLabel[x][y].setIcon(icoColonne);
|
||||
} else if (jeu.getGrille()[x][y][1] instanceof Corde) {
|
||||
tabJLabel[x][y].setIcon(icoCorde);
|
||||
} else {
|
||||
if (jeu.getGrille()[x][y][0] != null) {
|
||||
if (jeu.getGrille()[x][y][0] instanceof Heros)// si la grille du modèle contient un Pacman, on associe l'icône Pacman du côté de la vue
|
||||
// System.out.println("Héros !");
|
||||
tabJLabel[x][y].setIcon(icoHero);
|
||||
else if (jeu.getGrille()[x][y][0] instanceof Mur)
|
||||
tabJLabel[x][y].setIcon(icoMur);
|
||||
else if (jeu.getGrille()[x][y][0] instanceof Colonne)
|
||||
tabJLabel[x][y].setIcon(icoColonne);
|
||||
} else if (jeu.getGrille()[x][y][1] != null) {
|
||||
if (jeu.getGrille()[x][y][1] instanceof Corde)
|
||||
tabJLabel[x][y].setIcon(icoCorde);
|
||||
else if (jeu.getGrille()[x][y][1] instanceof Bombe)
|
||||
tabJLabel[x][y].setIcon(icoBombe);
|
||||
} else
|
||||
tabJLabel[x][y].setIcon(icoVide);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user