diff --git a/src/de/miaurizius/jgame2d/core/UI.java b/src/de/miaurizius/jgame2d/core/UI.java index 970ae55..5360606 100644 --- a/src/de/miaurizius/jgame2d/core/UI.java +++ b/src/de/miaurizius/jgame2d/core/UI.java @@ -234,7 +234,9 @@ public class UI { switch(optionState) { case OVERVIEW -> optionsTop(frameX, frameY); + case SCREENNF -> optionsFSNotify(frameX, frameY); } + panel.keyH.spacePressed = false; } public void drawDialogueScreen() { drawPlayerLife(); @@ -323,6 +325,7 @@ public class UI { messageCounter.add(0); } + // OPTIONS UI public void optionsTop(int frameX, int frameY) { int textX, textY; String title = "Options"; @@ -336,7 +339,10 @@ public class UI { graphics2d.drawString("Full Screen", textX, textY); if(commandNum == 0) { graphics2d.drawString(">", textX-25, textY); - if(panel.keyH.spacePressed) panel.fullscreen = !panel.fullscreen; + if(panel.keyH.spacePressed) { + optionState = OptionState.SCREENNF; + panel.fullscreen = !panel.fullscreen; + } } // MUSIC @@ -369,6 +375,9 @@ public class UI { textY = frameY + panel.tileSize*2 - panel.tileSize/2; graphics2d.setStroke(new BasicStroke(3)); graphics2d.drawRect(textX, textY, panel.tileSize/2, panel.tileSize/2); + if(panel.fullscreen) { + graphics2d.fillRect(textX, textY, panel.tileSize/2, panel.tileSize/2); + } // MUSIC VOLUME textY += panel.tileSize; @@ -378,10 +387,29 @@ public class UI { textY += panel.tileSize; graphics2d.drawRect(textX, textY, 120, panel.tileSize/2); } + public void optionsFSNotify(int frameX, int frameY) { + int textX = frameX + panel.tileSize; + int textY = frameY + panel.tileSize*3; + + currentDialogue = "The change will take \neffect after restarting \nthe game"; + for(String line : currentDialogue.split("\n")) { + graphics2d.drawString(line, textX, textY); + textY += 40; + } + + // BACK + textY =frameY + panel.tileSize*9; + graphics2d.drawString("Back", textX, textY); + if(commandNum == 0) { + graphics2d.drawString(">", textX-25, textY); + if(panel.keyH.spacePressed) optionState = OptionState.OVERVIEW; + } + + } public enum OptionState { OVERVIEW, - SCREEN, + SCREENNF, MUSIC, SFX, CONTROLS, diff --git a/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java b/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java index 1d82c30..e68812a 100644 --- a/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java +++ b/src/de/miaurizius/jgame2d/core/handlers/KeyHandler.java @@ -60,6 +60,7 @@ public class KeyHandler implements KeyListener { case KeyEvent.VK_ESCAPE -> { panel.gameState = GameState.PAUSE; panel.ui.optionState = UI.OptionState.OVERVIEW; + panel.ui.commandNum = 0; } case KeyEvent.VK_C -> panel.gameState = GameState.CHARACTER; }