continued options menu

This commit is contained in:
2025-12-09 14:47:43 +01:00
parent 2abdb3b5fb
commit 5192c8df87
3 changed files with 40 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ public class GamePanel extends JPanel implements Runnable {
int fScreenHeight = screenHeight;
BufferedImage tempScreen;
Graphics2D fg2;
public boolean fullscreen;
// WORLD SETTINGS
public final int maxWorldCol = 50;

View File

@@ -330,11 +330,14 @@ public class UI {
textY = frameY + panel.tileSize;
graphics2d.drawString(title, textX, textY);
// FULLSCREEN
// FULLSCREEN ON/OFF
textX = frameX + panel.tileSize;
textY += panel.tileSize;
graphics2d.drawString("Full Screen", textX, textY);
if(commandNum == 0) graphics2d.drawString(">", textX-25, textY);
if(commandNum == 0) {
graphics2d.drawString(">", textX-25, textY);
if(panel.keyH.spacePressed) panel.fullscreen = !panel.fullscreen;
}
// MUSIC
textY += panel.tileSize;
@@ -343,7 +346,7 @@ public class UI {
// SOUND EFFECTS
textY += panel.tileSize;
graphics2d.drawString("Sound Effects (SFX)", textX, textY);
graphics2d.drawString("SFX", textX, textY);
if(commandNum == 2) graphics2d.drawString(">", textX-25, textY);
// CONTROL
@@ -360,6 +363,20 @@ public class UI {
textY += panel.tileSize*2;
graphics2d.drawString("Back to Game", textX, textY);
if(commandNum == 5) graphics2d.drawString(">", textX-25, textY);
// FULL SCREEN CHECKBOX
textX = frameX + (int)(panel.tileSize*4.5);
textY = frameY + panel.tileSize*2 - panel.tileSize/2;
graphics2d.setStroke(new BasicStroke(3));
graphics2d.drawRect(textX, textY, panel.tileSize/2, panel.tileSize/2);
// MUSIC VOLUME
textY += panel.tileSize;
graphics2d.drawRect(textX, textY, 120, panel.tileSize/2);
// SFX VOLUME
textY += panel.tileSize;
graphics2d.drawRect(textX, textY, 120, panel.tileSize/2);
}
public enum OptionState {

View File

@@ -67,6 +67,25 @@ public class KeyHandler implements KeyListener {
public void handlePause(int code) {
if(code == KeyEvent.VK_SPACE) spacePressed = true;
int maxCommandNum = 0;
switch (panel.ui.optionState) {
case OVERVIEW -> maxCommandNum = 5;
}
switch(code) {
case KeyEvent.VK_UP:
if(panel.ui.commandNum <= 0) break;
panel.ui.commandNum--;
panel.playSE(9);
break;
case KeyEvent.VK_DOWN:
if(panel.ui.commandNum >= maxCommandNum) break;
panel.ui.commandNum++;
panel.playSE(9);
break;
}
// EXIT STATE
if(code == KeyEvent.VK_ESCAPE) panel.gameState = GameState.PLAY;
}