protected override void Update(GameTime gameTime)
        {
            var deltaTime     = (float)gameTime.ElapsedGameTime.TotalSeconds;
            var gamePadState  = GamePad.GetState(PlayerIndex.One);
            var keyboardState = Keyboard.GetState();

            // For Mobile devices, this logic will close the Game when the Back button is pressed
            if (gamePadState.Buttons.Back == ButtonState.Pressed || keyboardState.IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _timeLabel.Text = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now);
            _gui.Update(deltaTime);

            base.Update(gameTime);
        }
Exemple #2
0
        protected override void Update(GameTime gameTime)
        {
            var deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
            //var newGamePad = GamePad.GetState(PlayerIndex.One);
            //_keyboardManager._newKeyboardState = Keyboard.GetState();
            MouseState newMouseState = Mouse.GetState();

            // For Mobile devices, this logic will close the Game when the Back button is pressed
            //if (newGamePad.Buttons.Back == ButtonState.Pressed || _keyboardManager._newKeyboardState.IsKeyDown(Keys.Escape))
            //    Exit();



            /*
             *
             *
             *          if (_keyboardManager.IsKeyDown(Keys.Z)) // Press 'z' to zoom out.
             *                  ViewZoom = Math.Min(1.1f * ViewZoom, 20.0f);
             *          else if (_keyboardManager.IsKeyDown(Keys.X)) // Press 'x' to zoom in.
             *                  ViewZoom = Math.Max(0.9f * ViewZoom, 0.02f);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.R)) // Press 'r' to reset.
             *                  Restart();
             *          else if (_keyboardManager.IsNewKeyPress(Keys.P) || newGamePad.IsButtonDown(Buttons.Start) && _oldGamePad.IsButtonUp(Buttons.Start)) // Press I to prev test.
             *                  _settings.Pause = !_settings.Pause;
             *          else if (_keyboardManager.IsNewKeyPress(Keys.I) || newGamePad.IsButtonDown(Buttons.LeftShoulder) && _oldGamePad.IsButtonUp(Buttons.LeftShoulder))
             *          {
             *                  --_testSelection;
             *                  if (_testSelection < 0)
             *                          _testSelection = _testCount - 1;
             *          }
             *
             *
             *          else if (_keyboardManager.IsKeyDown(Keys.Left)) // Press left to pan left.
             *                  ViewCenter = new Vector2(ViewCenter.X - 0.5f, ViewCenter.Y);
             *          else if (_keyboardManager.IsKeyDown(Keys.Right)) // Press right to pan right.
             *                  ViewCenter = new Vector2(ViewCenter.X + 0.5f, ViewCenter.Y);
             *          else if (_keyboardManager.IsKeyDown(Keys.Down)) // Press down to pan down.
             *                  ViewCenter = new Vector2(ViewCenter.X, ViewCenter.Y - 0.5f);
             *          else if (_keyboardManager.IsKeyDown(Keys.Up)) // Press up to pan up.
             *                  ViewCenter = new Vector2(ViewCenter.X, ViewCenter.Y + 0.5f);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.Home)) // Press home to reset the view.
             *                  ResetView();
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F1))
             *                  EnableOrDisableFlag(DebugViewFlags.Shape);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F2))
             *                  EnableOrDisableFlag(DebugViewFlags.DebugPanel);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F3))
             *                  EnableOrDisableFlag(DebugViewFlags.PerformanceGraph);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F4))
             *                  EnableOrDisableFlag(DebugViewFlags.AABB);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F5))
             *                  EnableOrDisableFlag(DebugViewFlags.CenterOfMass);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F6))
             *                  EnableOrDisableFlag(DebugViewFlags.Joint);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F7))
             *          {
             *                  EnableOrDisableFlag(DebugViewFlags.ContactPoints);
             *                  EnableOrDisableFlag(DebugViewFlags.ContactNormals);
             *          }
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F8))
             *                  EnableOrDisableFlag(DebugViewFlags.PolygonPoints);
             *          else if (_keyboardManager.IsNewKeyPress(Keys.F9))
             *                  EnableOrDisableFlag(DebugViewFlags.PolygonPoints);
             *          else
             *          {
             *                  if (_test != null)
             *                          _test.Keyboard(_keyboardManager);
             *          }
             *
             *          if (_test != null)
             *                  _test.Mouse(newMouseState, _oldMouseState);
             *
             *          if (_test != null && newGamePad.IsConnected)
             *                  _test.Gamepad(newGamePad, _oldGamePad);
             *
             *
             *
             *          _keyboardManager._oldKeyboardState = _keyboardManager._newKeyboardState;
             *          _oldMouseState = newMouseState;
             *          _oldGamePad = newGamePad;
             */
            if (_test != null)
            {
                _test.TextLine = 30;
                _test.Update(_settings, gameTime);
            }


            _gui.Update(deltaTime);
            base.Update(gameTime);
        }