added start of options menu
This commit is contained in:
@@ -19,6 +19,7 @@ public class UI {
|
|||||||
BufferedImage heart_full, heart_half, heart_blank;
|
BufferedImage heart_full, heart_half, heart_blank;
|
||||||
ArrayList<String> messages = new ArrayList<>();
|
ArrayList<String> messages = new ArrayList<>();
|
||||||
ArrayList<Integer> messageCounter = new ArrayList<>();
|
ArrayList<Integer> messageCounter = new ArrayList<>();
|
||||||
|
public OptionState optionState;
|
||||||
public String currentDialogue;
|
public String currentDialogue;
|
||||||
public int commandNum;
|
public int commandNum;
|
||||||
public int slotCol, slotRow;
|
public int slotCol, slotRow;
|
||||||
@@ -230,6 +231,10 @@ public class UI {
|
|||||||
int frameWidth = panel.tileSize*8;
|
int frameWidth = panel.tileSize*8;
|
||||||
int frameHeight = panel.tileSize*10;
|
int frameHeight = panel.tileSize*10;
|
||||||
drawSubWindow(frameX, frameY, frameWidth, frameHeight);
|
drawSubWindow(frameX, frameY, frameWidth, frameHeight);
|
||||||
|
|
||||||
|
switch(optionState) {
|
||||||
|
case OVERVIEW -> optionsTop(frameX, frameY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void drawDialogueScreen() {
|
public void drawDialogueScreen() {
|
||||||
drawPlayerLife();
|
drawPlayerLife();
|
||||||
@@ -318,4 +323,51 @@ public class UI {
|
|||||||
messageCounter.add(0);
|
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,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package de.miaurizius.jgame2d.core.handlers;
|
package de.miaurizius.jgame2d.core.handlers;
|
||||||
|
|
||||||
import de.miaurizius.jgame2d.core.GamePanel;
|
import de.miaurizius.jgame2d.core.GamePanel;
|
||||||
|
import de.miaurizius.jgame2d.core.UI;
|
||||||
import de.miaurizius.jgame2d.core.enums.GameState;
|
import de.miaurizius.jgame2d.core.enums.GameState;
|
||||||
|
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
@@ -56,7 +57,10 @@ public class KeyHandler implements KeyListener {
|
|||||||
case KeyEvent.VK_R -> panel.tileM.loadMap(panel.currentMap);
|
case KeyEvent.VK_R -> panel.tileM.loadMap(panel.currentMap);
|
||||||
|
|
||||||
// GAME STATES
|
// 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;
|
case KeyEvent.VK_C -> panel.gameState = GameState.CHARACTER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user