/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here this.levelLoader = new ReadLevel(); this.levelEditor = new LevelEdit(false); //camera = new Camera(GraphicsDevice.Viewport); menu = new MainMenu(this.levelLoader, this); IsMouseVisible = true; listLoaded = false; camera = new Camera(GraphicsDevice.Viewport); base.Initialize(); }
public MainMenu(ReadLevel levelLoader, Game1 master) { this.levelLoader = levelLoader; this.master = master; //Adds lists of GUI elements to the menu list menus = new List <List <GUIElement> > { //MainMenu (new List <GUIElement> { new GUIElement("menu"), new GUIElement("nameBtn"), new GUIElement("play"), }), //Enter name menu (new List <GUIElement> { new GUIElement("name"), new GUIElement("done"), }), //Choose level menu (new List <GUIElement> { new GUIElement("menu"), new GUIElement("Levels"), new GUIElement("Level1"), new GUIElement("Level2"), new GUIElement("Level3"), }) }; for (int i = 0; i < menus.Count; i++) { foreach (GUIElement button in menus[i]) { button.clickEvent += OnClick; } } }