add main menu

This commit is contained in:
2026-07-16 17:00:12 +03:30
parent dc963742aa
commit a8d1b1011f
@@ -1,15 +1,49 @@
package org.project;
import org.project.location.Location;
import org.project.constants.appConstants.GameModes;
import org.project.constants.appConstants.TextColor;
import org.project.engine.MainEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO: ADD LOCATIONS TO YOUR GAME
List<Location> locations = new ArrayList<>();
static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
boolean endGame = false;
// TODO: IMPLEMENT GAMEPLAY
while (true) {
System.out.println(TextColor.Cyan + "JAVA KNIGHT" + TextColor.Reset);
System.out.println(
"""
0 > Single Player
1 > Local Multiplayer
2 > Exit
"""
);
GameModes gameMode = null;
while (true){
int choice = scanner.nextInt();
if (choice == 0) {
gameMode = GameModes.SINGLE_PLAYER;
break;
} else if (choice == 1) {
gameMode = GameModes.MULTI_PLAYER_LOCAL;
break;
} else if (choice == 2) {
endGame = true;
break;
}
}
if (endGame) {
break;
}
MainEngine engine = MainEngine.CreateEngine(gameMode);
engine.run();
}
}
}