finished options menu

This commit is contained in:
2025-12-11 19:21:06 +01:00
parent 21f4acf6b1
commit d294578a74
4 changed files with 73 additions and 15 deletions

View File

@@ -236,6 +236,7 @@ public class UI {
case OVERVIEW -> optionsTop(frameX, frameY);
case SCREENNF -> optionsFSNotify(frameX, frameY);
case CONTROLS -> optionsControls(frameX, frameY);
case QUITNF -> optionsQuitNotify(frameX, frameY);
}
panel.keyH.spacePressed = false;
}
@@ -372,7 +373,10 @@ public class UI {
graphics2d.drawString("Quit Game", textX, textY);
if(commandNum == 4) {
graphics2d.drawString(">", textX-25, textY);
if(panel.keyH.spacePressed) System.exit(0);
if(panel.keyH.spacePressed) {
optionState = OptionState.QUITNF;
commandNum = 0;
}
}
// BACK
@@ -383,6 +387,10 @@ public class UI {
if(panel.keyH.spacePressed) panel.gameState = GameState.PLAY;
}
//
// FUNCTIONALITY
//
// FULL SCREEN CHECKBOX
textX = frameX + (int)(panel.tileSize*4.5);
textY = frameY + panel.tileSize*2 - panel.tileSize/2;
@@ -402,6 +410,39 @@ public class UI {
graphics2d.drawRect(textX, textY, 120, panel.tileSize/2); // 120/5 = 24
graphics2d.fillRect(textX, textY, 24 * panel.se.volumeScale, panel.tileSize/2);
}
public void optionsControls(int frameX, int frameY) {
int textX;
int textY;
// TITLE
String text = "Controls";
textX = getCenteredX(text);
textY = frameY + panel.tileSize;
graphics2d.drawString(text, textX, textY);
textX = frameX + panel.tileSize;
textY +=panel.tileSize;
String[] options = {"Move", "Confirm/Attack", "Shoot/Cast", "Inventory", "Pause/Settings"};
for(String option : options) {
graphics2d.drawString(option, textX, textY);
textY += panel.tileSize;
}
textX = frameX + panel.tileSize*6;
textY = frameY + panel.tileSize*2;
options = new String[]{"WASD", "SPACE", "F", "C", "ESC"};
for(String option : options) {
graphics2d.drawString(option, textX, textY);
textY += panel.tileSize;
}
// BACK
textX = frameX + panel.tileSize;
textY = frameY + panel.tileSize*9;
graphics2d.drawString("Back", textX, textY);
graphics2d.drawString(">", textX-25, textY);
if(panel.keyH.spacePressed) optionState = OptionState.OVERVIEW;
}
public void optionsFSNotify(int frameX, int frameY) {
int textX = frameX + panel.tileSize;
int textY = frameY + panel.tileSize*3;
@@ -421,22 +462,36 @@ public class UI {
}
}
public void optionsControls(int frameX, int frameY) {
int textX;
int textY;
public void optionsQuitNotify(int frameX, int frameY) {
int textX = frameX + panel.tileSize;
int textY = frameY + panel.tileSize*3;
// TITLE
String text = "Controls";
currentDialogue = "Quit the game and \nreturn to the title screen?";
for(String line : currentDialogue.split("\n")) {
graphics2d.drawString(line, textX, textY);
textY += 40;
}
// DISPLAY OPTIONS
String text = "Yes";
textX = getCenteredX(text);
textY = frameY + panel.tileSize;
textY += panel.tileSize*3;
graphics2d.drawString(text, textX, textY);
if(commandNum == 0) {
graphics2d.drawString(">", textX-25, textY);
if(panel.keyH.spacePressed) {
panel.gameState = GameState.TITLE;
panel.stopMusic();
}
}
textX = frameX + panel.tileSize;
textY +=panel.tileSize;
String[] options = {"Move", "Confirm/Attack", "Shoot/Cast", "Inventory", "Pause/Settings"};
for(String option : options) {
graphics2d.drawString(option, textX, textY);
textY += panel.tileSize;
text = "No";
textX = getCenteredX(text);
textY += panel.tileSize;
graphics2d.drawString(text, textX, textY);
if(commandNum == 1) {
graphics2d.drawString(">", textX-25, textY);
if(panel.keyH.spacePressed) optionState = OptionState.OVERVIEW;
}
}
@@ -444,6 +499,7 @@ public class UI {
OVERVIEW,
SCREENNF,
CONTROLS,
QUITNF;
}
}