//Quit private void Option2(MenuItem m, EventArgs e) { //TODO: make more elegant. Currently there is an issue with objects being disposed, etc. try { game.Exit (); } catch(NullReferenceException ex) { Console.WriteLine(ex.StackTrace); } }
public PauseMenuScreen(GameScreenManager _screenManager, MainGame game) { screenManager = _screenManager; prevKeyboardState = Keyboard.GetState (); menu = new Menu ((new Vector2(MainGame.WindowWidth*0.5f, MainGame.WindowHeight*0.5f)), "Arial", 20); MenuItem menuItem1 = new MenuItem ("Resume"); menuItem1.Activated += new MenuItem.ActivatedHandler (Option1); MenuItem menuItem2 = new MenuItem ("Quit"); menuItem1.Activated += new MenuItem.ActivatedHandler (Option2); menu.AddItem (menuItem1); menu.AddItem (menuItem2); }
//Unpause game private void Option1(MenuItem m, EventArgs e) { screenManager.PopGameScreen (); }
public void AddItem(MenuItem item) { menuItems.Add (item); }