/// <summary> /// Create a menu, and add a title and 3 buttons to it /// </summary> public void setupMenu() { Font font = new Font(@"C:\\Windows\Fonts\Arial.ttf"); this.menu = new GameMenu(window.Size.X / 2, window.Size.Y / 2, 300, 400); this.menu.setMenuStyle(new Color(255, 255, 255, 150), Color.Red, 2); float menuCenterX = this.menu.getCentre().X; float menuCenterY = this.menu.getCentre().Y; MenuText title = new MenuText(menuCenterX, menuCenterY - 160, "Main Menu", font, 30); title.setTextStyle(Color.White, Color.Black, 1); this.menu.AddText(title); MenuButton btn1 = new MenuButton(menuCenterX, menuCenterY - 75, 200, 75, "White Text", font); btn1.setButtonStyle(Color.White, Color.Black, 2); btn1.setTextStyle(Color.Black, Color.Black, 0, 20); btn1.Click += Menu_WhiteText_Click; this.menu.AddButton(btn1); MenuButton btn2 = new MenuButton(menuCenterX, menuCenterY + 25, 200, 75, "Red Text", font); btn2.setButtonStyle(Color.White, Color.Black, 2); btn2.setTextStyle(Color.Black, Color.Black, 0, 20); btn2.Click += Menu_RedText_Click; this.menu.AddButton(btn2); MenuButton btn3 = new MenuButton(menuCenterX, menuCenterY + 125, 200, 75, "Exit", font); btn3.setButtonStyle(Color.White, Color.Black, 2); btn3.setTextStyle(Color.Black, Color.Black, 0, 20); btn3.Click += Menu_Exit_Click; this.menu.AddButton(btn3); }
/// <summary> /// Add button to the list /// </summary> /// <param name="button"></param> public void AddButton(MenuButton button) { buttons.Add(button); }