/// <summary> /// Update the game world. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { GamePadState gpState = GamePad.GetState(PlayerIndex.One); KeyboardState kbState = Keyboard.GetState(); // Check for exit if ((gpState.Buttons.Back == ButtonState.Pressed) || kbState.IsKeyDown(Keys.Escape)) { Exit(); } // Handle inputs for the sample camera camera.HandleDefaultGamepadControls(gpState, gameTime); camera.HandleDefaultKeyboardControls(kbState, gameTime); // Handle inputs specific to this sample HandleInput(gameTime, gpState, kbState); // The built-in camera class provides the view matrix grid.ViewMatrix = camera.ViewMatrix; // The camera position should also be updated for the // Phong specular component to be meaningful cameraPositionParameter[activeEffect].SetValue(camera.Position); // replace the "last" gamepad and keyboard states lastGpState = gpState; lastKbState = kbState; base.Update(gameTime); }