/// <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 game = new Game(new Rectangle(GraphicsDevice.Viewport.X, GraphicsDevice.Viewport.Y, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height)); randomNumberGenerator = new Random(); //isCollision = false; mainMenu = new Menu(); mainMenu.AddItem("Single-Player"); mainMenu.AddItem("Co-op 2-Player"); mainMenu.AddItem("Competitive 2-Player"); mainMenu.AddItem("Options"); mainMenu.AddItem("Quit"); mainMenu.activated = true; optionsMenu = new Menu(); optionsMenu.AddItem("THIS IS THE OPTIONS MENU"); optionsMenu.AddItem("Back"); colorBytes = new byte[3]; currentState = Keyboard.GetState(); //TEST************************** //randomNumberGenerator.NextBytes(colorBytes); //game.asteroids.Add(new GameObject(new Vector2(0, 0), new Vector2(1.0f, 0.75f), 10, new Color(colorBytes[0], colorBytes[1], colorBytes[2]), 0.0f, 0.0f)); //TEST************************** base.Initialize(); }
private void DrawMenu(Menu menu) { Color color; foreach (String item in menu.GetOptions()) { if (menu.GetHighlighted() == menu.GetOptions().IndexOf(item)) { color = Color.Yellow; } else { color = Color.White; } DrawString(new Vector2(GraphicsDevice.Viewport.Width / 2, 50f + 50f * menu.GetOptions().IndexOf(item)), item, color); } }