Welcome screen
This commit is contained in:
parent
e085f3393f
commit
97b0a4ad00
|
|
@ -80,7 +80,28 @@ public class JPanelChessBoard extends JPanel {
|
|||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
super.paintComponent(g);
|
||||
this.setBackground(Color.black);
|
||||
this.setBackground(new Color(170, 51, 106));
|
||||
|
||||
if (myGame == null) {
|
||||
// Display title before game starts
|
||||
g.setColor(Color.WHITE);
|
||||
g.setFont(g.getFont().deriveFont(48f)); // larger font size
|
||||
String title = "Chess Project";
|
||||
int stringWidth = g.getFontMetrics().stringWidth(title);
|
||||
int x = (getWidth() - stringWidth) / 2;
|
||||
int y = getHeight() / 2;
|
||||
g.drawString(title, x, y);
|
||||
|
||||
g.setFont(g.getFont().deriveFont(24f)); // Smaller font for subtitle
|
||||
String subtitle = "Groupe 2A5";
|
||||
int subtitleWidth = g.getFontMetrics().stringWidth(subtitle);
|
||||
int x2 = (getWidth() - subtitleWidth) / 2;
|
||||
int y2 = y + 40; // 40 pixels below the title, adjust spacing if needed
|
||||
g.drawString(subtitle, x2, y2);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(pieceSelectorMode) {
|
||||
g.drawImage(
|
||||
spriteSheet,
|
||||
|
|
|
|||
Loading…
Reference in New Issue