public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = GlobalValues.BackBufferWidth; graphics.PreferredBackBufferHeight = GlobalValues.BackBufferHeight; Content.RootDirectory = "Content"; //Debugging currentScreen = GlobalValues.ActiveScreen.MainMenu; //gameState = GlobalValues.GameState.Paused; //menuState = GlobalValues.MenuState.Running; //btnSize = new Vector2(76, 26); newBColor = Color.White; loadBColor = Color.White; optionsBColor = Color.White; exitBColor = Color.White; // option1Color = Color.White; option2color = Color.White; option3color = Color.White; MMindex = 0; OPindex = 0; Pindex = 0; PauseSelect1 = Color.White; PauseSelect2 = Color.White; path = "C:/Users/Sean Kennedy/Desktop/MenuScreenProof/MenuScreenProof/MenuScreenProofContent/Test.txt"; //BGM MediaPlayer.IsRepeating = true; MediaPlayer.Play(Content.Load<Song>("Sounds/BGM")); //------------ }
protected override void Update(GameTime gameTime) { // Allows the game to exit #region Main Menu Update Stuff if (currentScreen == GlobalValues.ActiveScreen.MainMenu) { //check mouse position stuff //check for changes in the state stuff if (MMindex > 3) MMindex = 0; if (MMindex < 0) MMindex = 3; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down)) { MMindex++; Thread.Sleep(100); } if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up)) { MMindex--; Thread.Sleep(100); } //new GameButton if (MMindex == 0) //maybe try an index?... no...that would do the same thing. { newBColor = Color.Red; //newGbuttonState = GlobalValues.ButtonState.Highlighted; loadBColor = Color.White; //loadgbuttonState = GlobalValues.ButtonState.Idle; exitBColor = Color.White; //exitGbuttonState = GlobalValues.ButtonState.Idle; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter)) currentScreen = GlobalValues.ActiveScreen.GamePlay; } else if (MMindex == 1) { newBColor = Color.White; //newGbuttonState = GlobalValues.ButtonState.Idle; loadBColor = Color.Red; //loadgbuttonState = GlobalValues.ButtonState.Highlighted; optionsBColor = Color.White; //optionsbuttonState = GlobalValues.ButtonState.Idle; } else if (MMindex == 2) { loadBColor = Color.White; //loadgbuttonState = GlobalValues.ButtonState.Idle; optionsBColor = Color.Red; //optionsbuttonState = GlobalValues.ButtonState.Highlighted; exitBColor = Color.White; //exitGbuttonState = GlobalValues.ButtonState.Idle; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter)) currentScreen = GlobalValues.ActiveScreen.Options; } else if (MMindex == 3) { optionsBColor = Color.White; //optionsbuttonState = GlobalValues.ButtonState.Idle; exitBColor = Color.Red; //exitGbuttonState = GlobalValues.ButtonState.Highlighted; newBColor = Color.White; //newGbuttonState = GlobalValues.ButtonState.Idle; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter)) this.Exit(); } }//end if MainMenu #endregion #region GamePlay Screen else if (currentScreen == GlobalValues.ActiveScreen.GamePlay) { //This is supposed to pause the game. Stop all action and bring up the pause menu. //returns to the main menu for now. if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape)) currentScreen = GlobalValues.ActiveScreen.Pause; //Then it should update the player and the enemies and such. player.Update(); } #endregion #region Options Screen else if (currentScreen == GlobalValues.ActiveScreen.Options) { if (OPindex > 3) OPindex = 0; if (OPindex < 0) OPindex = 3; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape)) currentScreen = GlobalValues.ActiveScreen.MainMenu; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down)) { OPindex++; Thread.Sleep(100); } if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up)) { OPindex--; Thread.Sleep(100); } if (OPindex == 0) { option1Color = Color.Red; option2color = Color.White; option3color = Color.White; //these will have a point later, but for now, they're just here. } else if (OPindex == 1) { option1Color = Color.White; option2color = Color.Red; option3color = Color.White; } else if (OPindex == 2) { option1Color = Color.White; option2color = Color.White; option3color = Color.Red; } } #endregion #region Pause else if (currentScreen == GlobalValues.ActiveScreen.Pause) { if (Pindex > 1) Pindex = 1; if (Pindex < 0) Pindex = 0; // if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Escape)) //currentScreen = GlobalValues.ActiveScreen.MainMenu;//<!--> if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Down)) { Pindex++; Thread.Sleep(100); } if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Up)) { Pindex--; Thread.Sleep(100); } if (Pindex == 0) { PauseSelect1 = Color.Red; PauseSelect2 = Color.White; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter)) currentScreen = GlobalValues.ActiveScreen.MainMenu; //<!--> } else if (Pindex == 1) { PauseSelect1 = Color.White; PauseSelect2 = Color.Red; if (Keyboard.GetState(PlayerIndex.One).IsKeyDown(Keys.Enter)) currentScreen = GlobalValues.ActiveScreen.MainMenu;//<!--> } } #endregion // TODO: Add your update logic here base.Update(gameTime); }