public GameState Update(Microsoft.Xna.Framework.GameTime gameTime) { lastState = currentState; currentState = Mouse.GetState(); if (currentState.LeftButton == ButtonState.Released && lastState.LeftButton == ButtonState.Pressed) { if (!detailPictureOutlines.Contains(new Point(currentState.X, currentState.Y))) { GameSpecs.PreviousGamestate = GameState.ImageDetailView; return(GameState.Highscore); } Extension.SetStates(ref currentState, ref lastState); } return(GameState.ImageDetailView); }
public GameState Update(Microsoft.Xna.Framework.GameTime gameTime) { lastState = currentState; currentState = Mouse.GetState(); KeyboardState kbState = Keyboard.GetState(); // Hover-Check-Routines if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[0].Texture = newGame_select; } else { bl[0].Texture = newGame; } if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[1].Texture = options_select; } else { bl[1].Texture = options; } if (bl[2].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[2].Texture = quit_select; } else { bl[2].Texture = quit; } // Check-Routine for catching clicks on the buttons if (currentState.LeftButton == ButtonState.Released && lastState.LeftButton == ButtonState.Pressed) { // Button to start game if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { g.Clear(Color.Black); Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); Extension.SetStates(ref currentState, ref lastState); return(GameState.ChooseDifficulty); } // Button to open optionsmenu if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { g.Clear(Color.Black); Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); Extension.SetStates(ref currentState, ref lastState); return(GameState.OptionMenu); } // Button to end game if (bl[2].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { g.Clear(Color.Black); Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); Extension.SetStates(ref currentState, ref lastState); Extension.ShutDownKinect(); return(GameState.None); } } if (kbState.IsKeyDown(Keys.Escape)) { g.Clear(Color.Black); Thread.Sleep(200); return(GameState.Running); } else { Extension.SetStates(ref currentState, ref lastState); return(GameState.MainMenuNoSession); } }
public GameState Update(Microsoft.Xna.Framework.GameTime gameTime) { lastState = currentState; currentState = Mouse.GetState(); KeyboardState kbState = Keyboard.GetState(); // Hover-Check-Routines if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[0].Texture = resume_select; } else { bl[0].Texture = resume; } if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { bl[1].Texture = quit_select; } else { bl[1].Texture = quit; } // Check-Routine for catching clicks on the buttons if (currentState.LeftButton == ButtonState.Released && lastState.LeftButton == ButtonState.Pressed) { // Button to resume game if (bl[0].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { g.Clear(Color.Black); Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); GameSpecs.PreviousGamestate = GameState.MainMenuSession; Extension.SetStates(ref currentState, ref lastState); return(GameState.Running); } // Button to end session if (bl[1].ClickTangle.Contains(new Point(currentState.X, currentState.Y))) { Session.ResetSession(); g.Clear(Color.Black); Extension.PlaySoundEffect("menuClick"); Thread.Sleep(200); GameSpecs.PreviousGamestate = GameState.MainMenuSession; Extension.SetStates(ref currentState, ref lastState); return(GameState.MainMenuNoSession); } } if (kbState.IsKeyDown(Keys.Escape)) { g.Clear(Color.Black); Thread.Sleep(200); return(GameState.Running); } else { Extension.SetStates(ref currentState, ref lastState); return(GameState.MainMenuSession); } }