public override void Update(GameTime gameTime) { GameObjectBase obj; TouchCollection tc; base.Update(gameTime); // Update all the game objects _game.UpdateAll(gameTime); // Has the user touched the screen? tc = TouchPanel.GetState(); if (tc.Count == 1 && tc[0].State == TouchLocationState.Pressed) { // Find the object at the touch point obj = _game.GetSpriteAtPoint(tc[0].Position); // Did we get a settings option object? if (obj is GameFramework.SettingsItemObject) { // Yes, so toggle it to the next value ((SettingsItemObject)obj).SelectNextValue(); } else if (obj is TextObject) { // No, but see if this is a tagged object that we recognise switch (obj.Tag) { case "Continue": // Return to the game _game.SetGameMode <Mode_Game>(); break; } } } // Has the user pressed the Back button? if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { // Return to the game _game.SetGameMode <Mode_Game>(); } }
public override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { _game.Exit(); } base.Update(gameTime); TouchCollection tc; // Has the user touched the screen? tc = TouchPanel.GetState(); if (tc.Count == 1 && tc[0].State == TouchLocationState.Pressed) { // Enter settings mode _game.SetGameMode <Mode_Settings>(); } // Update all the game objects _game.UpdateAll(gameTime); }