added title screen
This commit is contained in:
@@ -10,6 +10,7 @@ public class UI {
|
||||
Graphics2D graphics2d;
|
||||
Font arial_40, arial_80B;
|
||||
public String currentDialogue;
|
||||
public int commandNum = 0;
|
||||
|
||||
public UI(GamePanel panel) {
|
||||
this.panel = panel;
|
||||
@@ -33,6 +34,9 @@ public class UI {
|
||||
case GameState.DIALOGUE:
|
||||
drawDialogueScreen();
|
||||
break;
|
||||
case TITLE:
|
||||
drawTitleScreen();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +65,45 @@ public class UI {
|
||||
}
|
||||
}
|
||||
|
||||
public void drawTitleScreen() {
|
||||
graphics2d.setColor(new Color(0, 0, 0));
|
||||
graphics2d.fillRect(0, 0, panel.screenWidth, panel.screenHeight);
|
||||
|
||||
// TITLE NAME
|
||||
graphics2d.setFont(graphics2d.getFont().deriveFont(Font.BOLD, 96F));
|
||||
String text = "JGame2D";
|
||||
int x = getCenteredX(text);
|
||||
int y = panel.tileSize*3;
|
||||
|
||||
// SHADOW
|
||||
graphics2d.setColor(Color.gray);
|
||||
graphics2d.drawString(text, x+5, y+5);
|
||||
|
||||
// MAIN COLOR
|
||||
graphics2d.setColor(Color.white);
|
||||
graphics2d.drawString(text, x, y);
|
||||
|
||||
// MENU
|
||||
graphics2d.setFont(graphics2d.getFont().deriveFont(Font.BOLD, 48F));
|
||||
text = "NEW GAME";
|
||||
x = getCenteredX(text);
|
||||
y += panel.tileSize*4;
|
||||
graphics2d.drawString(text, x, y);
|
||||
if(commandNum == 0) graphics2d.drawString(">", x-panel.tileSize, y);
|
||||
|
||||
text = "LOAD GAME";
|
||||
x = getCenteredX(text);
|
||||
y += panel.tileSize;
|
||||
graphics2d.drawString(text, x, y);
|
||||
if(commandNum == 1) graphics2d.drawString(">", x-panel.tileSize, y);
|
||||
|
||||
text = "QUIT";
|
||||
x = getCenteredX(text);
|
||||
y += panel.tileSize;
|
||||
graphics2d.drawString(text, x, y);
|
||||
if(commandNum == 2) graphics2d.drawString(">", x-panel.tileSize, y);
|
||||
}
|
||||
|
||||
public void drawSubWindow(int x, int y, int width, int height) {
|
||||
graphics2d.setColor(new Color(0,0,0,210));
|
||||
graphics2d.fillRoundRect(x, y, width, height, 35, 35);
|
||||
|
||||
Reference in New Issue
Block a user