diff --git a/src/de/miaurizius/jgame2d/core/UI.java b/src/de/miaurizius/jgame2d/core/UI.java index c9c744d..3621897 100644 --- a/src/de/miaurizius/jgame2d/core/UI.java +++ b/src/de/miaurizius/jgame2d/core/UI.java @@ -19,6 +19,7 @@ public class UI { BufferedImage heart_full, heart_half, heart_blank; ArrayList messages = new ArrayList<>(); ArrayList messageCounter = new ArrayList<>(); + public OptionState optionState; public String currentDialogue; public int commandNum; public int slotCol, slotRow; @@ -230,6 +231,10 @@ public class UI { int frameWidth = panel.tileSize*8; int frameHeight = panel.tileSize*10; drawSubWindow(frameX, frameY, frameWidth, frameHeight); + + switch(optionState) { + case OVERVIEW -> optionsTop(frameX, frameY); + } } public void drawDialogueScreen() { drawPlayerLife(); @@ -318,4 +323,51 @@ public class UI { messageCounter.add(0); } + public void optionsTop(int frameX, int frameY) { + int textX, textY; + String title = "Options"; + textX = getCenteredX(title); + textY = frameY + panel.tileSize; + graphics2d.drawString(title, textX, textY); + + // FULLSCREEN + textX = frameX + panel.tileSize; + textY += panel.tileSize; + graphics2d.drawString("Full Screen", textX, textY); + if(commandNum == 0) graphics2d.drawString(">", textX-25, textY); + + // MUSIC + textY += panel.tileSize; + graphics2d.drawString("Music", textX, textY); + if(commandNum == 1) graphics2d.drawString(">", textX-25, textY); + + // SOUND EFFECTS + textY += panel.tileSize; + graphics2d.drawString("Sound Effects (SFX)", textX, textY); + if(commandNum == 2) graphics2d.drawString(">", textX-25, textY); + + // CONTROL + textY += panel.tileSize; + graphics2d.drawString("Controls", textX, textY); + if(commandNum == 3) graphics2d.drawString(">", textX-25, textY); + + // END GAME + textY += panel.tileSize; + graphics2d.drawString("Quit Game", textX, textY); + if(commandNum == 4) graphics2d.drawString(">", textX-25, textY); + + // BACK + textY += panel.tileSize*2; + graphics2d.drawString("Back to Game", textX, textY); + if(commandNum == 5) graphics2d.drawString(">", textX-25, textY); + } + + public enum OptionState { + OVERVIEW, + SCREEN, + MUSIC, + SFX, + CONTROLS, + } + } diff --git a/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java b/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java index 9b6fb24..5d97646 100644 --- a/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java +++ b/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java @@ -1,6 +1,7 @@ package de.miaurizius.jgame2d.core.handlers; import de.miaurizius.jgame2d.core.GamePanel; +import de.miaurizius.jgame2d.core.UI; import de.miaurizius.jgame2d.core.enums.GameState; import java.awt.event.KeyEvent; @@ -56,7 +57,10 @@ public class KeyHandler implements KeyListener { case KeyEvent.VK_R -> panel.tileM.loadMap(panel.currentMap); // GAME STATES - case KeyEvent.VK_ESCAPE -> panel.gameState = GameState.PAUSE; + case KeyEvent.VK_ESCAPE -> { + panel.gameState = GameState.PAUSE; + panel.ui.optionState = UI.OptionState.OVERVIEW; + } case KeyEvent.VK_C -> panel.gameState = GameState.CHARACTER; } }