/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } if (Keyboard.GetState().IsKeyDown(Keys.F) && !fullscreenSwitch) { fullscreenSwitch = true; } if (Keyboard.GetState().IsKeyUp(Keys.F) && fullscreenSwitch) { fullscreenSwitch = false; graphics.ToggleFullScreen(); } if (state != lastState) { switch (state) { case Scenes.intro: intro.Initialize(); intro.LoadContent(this); break; case Scenes.menu: //Handle break; case Scenes.game: game.Initialize(); game.LoadContent(this); break; case Scenes.end: end.Initialize(); end.LoadContent(this); break; } lastState = state; } switch (state) { case Scenes.intro: intro.Update(gameTime); break; case Scenes.menu: //Handle break; case Scenes.game: game.Update(gameTime); break; case Scenes.end: end.Update(gameTime); break; } // TODO: Add your update logic here float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; base.Update(gameTime); }