changed waiting screen

This commit is contained in:
Romain MURPHY 2025-05-08 16:58:24 +02:00
parent b3a3813464
commit 89dc810d43
3 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,7 @@ public class Main {
// launches graphical interface :
MyInterface mjf = new MyInterface();
mjf.introduction();
// mjf.introduction();
mjf.setVisible(true);
}

View File

@ -10,6 +10,7 @@ import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
import backend.Game;
@ -30,6 +31,8 @@ public class JPanelChessBoard extends JPanel {
private boolean selectedPieceIsWhite;
private PieceType selectedPieceType;
private boolean pieceAdderMode;
private Image backgroundImage;
public JPanelChessBoard(MyInterface itf) {
super();
@ -38,6 +41,7 @@ public class JPanelChessBoard extends JPanel {
selectedPieceIsWhite = true;
selectedPieceType = PieceType.Pawn;
pieceSelectorMode = false;
backgroundImage = new ImageIcon(getClass().getResource("image_OOP.png")).getImage();
try {
spriteSheet = ImageIO.read(new File("pieces/newPieces.png"));
@ -81,7 +85,8 @@ public class JPanelChessBoard extends JPanel {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
this.setBackground(new Color(238,236,208));
g.drawImage(backgroundImage, 0, 0, getWidth(), getHeight(), this);
// this.setBackground(new Color(238,236,208));
if(pieceSelectorMode) {
g.drawImage(
spriteSheet,
@ -95,6 +100,9 @@ public class JPanelChessBoard extends JPanel {
}
if (myGame != null) {
// Draw Interface from state of simulator
g.setColor(new Color(238, 236, 208)); // Your default color
g.fillRect(0, 0, getWidth(), getHeight());
repaint();
float cellWidth = cellWidth();
float cellHeight = cellHeight();

View File

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 367 KiB