private void DisplayMap()
        {
            maxMapHeight = Console.WindowHeight - 2;
            maxMapWidth  = Console.WindowWidth - 32;

            MainMenuHelper.MakeFrame();
            foreach (MapTemplate mt in EditorInstance.Templates)
            {
                Console.ForegroundColor = mt.Color;

                for (int i = currentTopMargin; i < currentTopMargin + maxMapHeight; i++)
                {
                    for (int j = currentLeftMargin; j < currentLeftMargin + maxMapWidth; j++)
                    {
                        if (j < mt.MapWidth && i < mt.MapHeight && mt.Layout[j, i] != ' ')
                        {
                            Console.SetCursorPosition(j + mapStartLeftMargin - currentLeftMargin, i + mapStartTopMargin - currentTopMargin);
                            Console.Write(mt.Layout[j, i]);
                        }
                    }
                }

                Console.SetCursorPosition(cursorLeftPosition + mapStartLeftMargin, cursorTopPosition + mapStartTopMargin);
                Console.ForegroundColor = ConsoleColor.Gray;
            }
        }
        private void DisplayMapSelection()
        {
            //Load maps
            mainMaps   = Helper.GetAndVerifyMaps(Environment.CurrentDirectory + "\\Map layouts\\Main");
            customMaps = Helper.GetAndVerifyMaps(Environment.CurrentDirectory + "\\Map layouts\\Custom");

            //New game top part
            MainMenuHelper.MakeEdges('|', 0);
            MainMenuHelper.MakeFrame();
            MainMenuHelper.MakeEdges('|', Console.WindowHeight - 2);
            MainMenuHelper.WriteInCenter("New game", 2);
            MainMenuHelper.FillALine('=', 1, 4);

            for (int i = 5; i < Console.WindowHeight - 6; i++)
            {
                MainMenuHelper.WriteInCenter("|", Console.CursorTop);
            }

            //Display main maps
            MainMenuHelper.WriteText("Main maps", 3, 6);
            for (int i = 0; i < mainMaps.Count; i++)
            {
                if (currentTabIndex == 0 && currentCursorIndex == i)
                {
                    MainMenuHelper.WriteText(mainMaps[i].Split('\\')[^ 1], 6, ConsoleColor.Gray, ConsoleColor.Blue);
        private void DisplayEscMenu()
        {
            MainMenuHelper.MakeFrame();
            MainMenuHelper.WriteInCenter("What do you want to do?", 2);

            MainMenuHelper.WriteSelectableTextInCenter("Go back", 6, 0, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Save and exit", 8, 1, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Exit without saving", 10, 2, currentCursorIndex);
        }
        private void DisplayNewMap()
        {
            while (true)
            {
                currentCursorIndexLimit = 2;
                Console.SetWindowSize(30, 14);
                Console.SetBufferSize(30, 14);

                MainMenuHelper.MakeFrame();
                MainMenuHelper.WriteInCenter("New map", 2);
                MainMenuHelper.FillALine('=', 1, 4);

                MainMenuHelper.WriteInCenter("Map name: ", 6);
                MainMenuHelper.WriteText(mapNameInput.PadRight(14), 8, 8);
                MainMenuHelper.WriteInCenter("‾‾‾‾‾‾‾‾‾‾‾‾‾‾", 9);

                Console.SetCursorPosition(8 + mapNameInput.Length, 8);
                Console.CursorVisible = true;
                ConsoleKeyInfo input = Console.ReadKey();

                switch (input.Key)
                {
                case ConsoleKey.Enter:
                    StartEditor();
                    return;

                case ConsoleKey.Backspace:
                    if (mapNameInput.Length > 0)
                    {
                        mapNameInput = mapNameInput.Remove(mapNameInput.Length - 1);
                    }
                    break;

                case ConsoleKey.Escape:
                    currentSection = MapEditorSection.Menu;
                    Console.Clear();
                    Console.CursorVisible = false;
                    DisplayMenu();     //I need to display the menu here, or else the player will be on a blank screen.
                    return;

                default:
                    if (mapNameInput.Length < 14)
                    {
                        if (input.KeyChar == ' ')
                        {
                            mapNameInput += ' ';
                        }
                        else
                        {
                            //trim used for getting rid of characters like pgup, del, insert, tab
                            mapNameInput += input.KeyChar.ToString().Trim();
                        }
                    }
                    break;
                }
            }
        }
        private void DisplayEditMap()
        {
            foundMaps = Helper.GetAndVerifyMaps(Environment.CurrentDirectory + "\\Map layouts\\Main");

            currentCursorIndexLimit = foundMaps.Count - 1;

            MainMenuHelper.MakeFrame();
            MainMenuHelper.WriteInCenter("Edit a map", 2);

            for (int i = 0; i < foundMaps.Count; i++)
            {
                string mapName = foundMaps[i].Split('\\')[^ 1];
        private void DisplayMainMenu()
        {
            CursorIndexLimit = 3;
            MainMenuHelper.MakeFrame();
            //Title text
            DisplayMainTitle();
            MainMenuHelper.FillALine('=', 1, 13);

            MainMenuHelper.WriteSelectableTextInCenter("Play", 15, 0, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Editor", 18, 1, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Settings", 21, 2, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Exit", 24, 3, currentCursorIndex);
        }
        private void DisplayMenu()
        {
            currentCursorIndexLimit = 2;
            Console.SetWindowSize(30, 14);
            Console.SetBufferSize(30, 14);

            MainMenuHelper.MakeFrame();
            MainMenuHelper.WriteInCenter("Map editor", 2);
            MainMenuHelper.FillALine('=', 1, 4);

            MainMenuHelper.WriteSelectableTextInCenter("Create a new map", 6, 0, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Edit an existing map", 8, 1, currentCursorIndex);
            MainMenuHelper.WriteSelectableTextInCenter("Back to main menu", 10, 2, currentCursorIndex);
        }
        private void DisplayRightPanel()
        {
            string color = StringToColor.ConvertToString(currentColor).PadRight(12);

            MainMenuHelper.MakeFrame(Console.WindowWidth - 31, 0);
            int textStart = Console.WindowWidth - 29;

            MainMenuHelper.WriteInCenter("Settings", 3, textStart, 2);

            MainMenuHelper.WriteText("Current X position: " + cursorLeftPosition.ToString().PadRight(4), textStart, 5);
            MainMenuHelper.WriteText("Current Y position: " + (EditorInstance.MapHeight - cursorTopPosition - 1).ToString().PadRight(4), textStart, 6);

            if (currentTabIndex == 0)
            {
                MainMenuHelper.WriteText("Current color: " + color, textStart, 8);
                MainMenuHelper.WriteText("Map height: " + EditorInstance.MapHeight.ToString().PadRight(4), textStart, 10);
                MainMenuHelper.WriteText("Map width:  " + EditorInstance.MapWidth.ToString().PadRight(4), textStart, 11);
            }
            else if (currentTabIndex == 1)
            {
                //Current color
                if (currentCursorIndex == 0)
                {
                    if (!enterPressed)
                    {
                        MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Gray, ConsoleColor.Blue);
                    }
                    else if (enterPressed)
                    {
                        MainMenuHelper.WriteText("Current color: " + color, textStart, 8, ConsoleColor.Black, ConsoleColor.Cyan);
                    }
                }
                else
                {
                    MainMenuHelper.WriteText("Current color: " + color, textStart, 8);
                }

                //Map height
                string mapHeight = EditorInstance.MapHeight.ToString().PadRight(4);
                MainMenuHelper.WriteText("Map height: ", textStart, 10);
                if (currentCursorIndex == 1)
                {
                    if (!enterPressed)
                    {
                        MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Gray, ConsoleColor.Blue);
                    }
                    else if (enterPressed)
                    {
                        MainMenuHelper.WriteText(mapHeight, textStart + 12, 10, ConsoleColor.Black, ConsoleColor.Cyan);
                    }
                }
                else
                {
                    MainMenuHelper.WriteText(mapHeight, textStart + 12, 10);
                }

                //Map width
                string mapWidth = EditorInstance.MapWidth.ToString().PadRight(4);
                MainMenuHelper.WriteText("Map width:  ", textStart, 11);
                if (currentCursorIndex == 2)
                {
                    if (!enterPressed)
                    {
                        MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Gray, ConsoleColor.Blue);
                    }
                    else if (enterPressed)
                    {
                        MainMenuHelper.WriteText(mapWidth, textStart + 12, 11, ConsoleColor.Black, ConsoleColor.Cyan);
                    }
                }
                else
                {
                    MainMenuHelper.WriteText(mapWidth, textStart + 12, 11);
                }
            }
        }