public MenuEngine2(CoreEngine g)
        {
            coreEngine = g;

            mainMenu = new Menu(MenuState.MainMenu);
            //mainMenu.offset = new Vector2(150, 50);
            mainMenu.initial = 5;
            mainMenu.addItem("Single Player",MenuState.SinglePlayer);
            //mainMenu.addItem("Split Screen",MenuState.SplitScreen);
            //mainMenu.addItem("Options",MenuState.Options);
            mainMenu.addItem("Exit",MenuState.Exit);

            currentMenu = mainMenu;
            setCurrentMenu(MenuState.MainMenu);

            singlePlayerMenu = new Menu(MenuState.MainMenu);
            //singlePlayerMenu.offset = new Vector2(150, 50);
            refreshSPMenu();

            selectMapMenu = new Menu(MenuState.SinglePlayer);
            selectMapMenu.maxDist = 100;
            selectMapMenu.level = 2;
            //selectMapMenu.offset = new Vector2(150, 50);
            selectMapMenu.addItem("Shipment", MenuState.Null);
            selectMapMenu.addItem("Backlot", MenuState.Null);

            botNumberMenu = new Menu(MenuState.SinglePlayer);
            botNumberMenu.maxDist = 100;
            botNumberMenu.level = 2;
            //botNumberMenu.offset = new Vector2(150, 50);
            refreshMaxBots(7);
            Console.WriteLine("menu engine initialized.");
        }
        public void setCurrentMenu(MenuState m)
        {
            currentMenu.dist = 0;
            //setOverlayMode = false;

            //Console.WriteLine(m);
            if (!setOverlayMode)
                menuStack.Clear();

            menuStack.Insert(0, currentMenu.getItems());

            switch (m)
            {

                case MenuState.MainMenu:
                    currentMenu = mainMenu;
                    setOverlayMode = false;
                    break;
                case MenuState.SinglePlayer:
                    currentMenu = singlePlayerMenu;
                    setOverlayMode = false;
                    break;
                case MenuState.StartGame:
                    startGame();
                    break;
                case MenuState.SelectMap:
                    setOverlayMode = true;
                    currentMenu = selectMapMenu;
                    //Load map list from map engine
                    break;
                case MenuState.BotOptions:
                    setOverlayMode = true;
                    currentMenu = botNumberMenu;
                    break;
                case MenuState.SplitScreen:
                    setOverlayMode = false;
                    Console.WriteLine("SplitScreen Selected from arc");
                    break;
                case MenuState.Options:
                    setOverlayMode = false;
                    Console.WriteLine("Options Selected from arc");
                    break;
                case MenuState.Exit:
                    coreEngine.Exit();
                    break;
                //when storing variable changes
                case MenuState.Null:
                    if (currentMenu == selectMapMenu)
                    {
                        //store name of chosen map (selected item)
                    }
                    if (currentMenu == botNumberMenu)
                    {
                        //store name of chosen number of bots
                        selectedNumBots= Int16.Parse(currentMenu.getSelectedItem().label);
                        refreshSPMenu();
                    }
                    setCurrentMenu(currentMenu.previousMenu);
                    break;

            }

            //Console.WriteLine("--------------\n"+menuStack.Count);

            if (!setOverlayMode)
                menuStack.Clear();
            else if (menuStack.Count >= currentMenu.level)
            {
                menuStack.RemoveAt(0);
                menuStack.RemoveAt(0);
                //Console.WriteLine(menuStack.Count);
            }

            menuStack.Insert(0, currentMenu.getItems());
            //Console.WriteLine(menuStack.Count);
        }