From a8d1b1011f2c4e4dfbfba73c5cb293f8fc3b4be6 Mon Sep 17 00:00:00 2001 From: Ramtin Jafari Date: Thu, 16 Jul 2026 17:00:12 +0330 Subject: [PATCH] add main menu --- .../src/main/java/org/project/Main.java | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/Java-Knight/src/main/java/org/project/Main.java b/Java-Knight/src/main/java/org/project/Main.java index 6bde20e..2635970 100644 --- a/Java-Knight/src/main/java/org/project/Main.java +++ b/Java-Knight/src/main/java/org/project/Main.java @@ -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 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(); + } } } \ No newline at end of file