Exemple #1
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // Updates and process key related actions.
            KeysAndTextInput.Update(gameTime);

            // Update the frame rate and gc display.
            frameRate.Update(gameTime);

            int tmp = msg2.Length;

            msg2.Clear();
            msg2
            .Append("\n F12 to force a collect. , Control + Delete to clear the string. NumLock Fixed or not fixed fps.").Append("")
            .Append("\n F7 F8 DisplayRecordedTypedCharacters ").Append(VisualKeyboardDisplay.DisplayRecordedTypedCharacters)
            .Append("\n msg2.Length ").Append(tmp).Append("  msg2.Capacity ").Append(msg2.Capacity)
            .Append("\n msg.Length ").Append(msg.Length).Append("  msg.Capacity ").Append(msg.Capacity)
            .Append("\n RepressSpeed ").Append(KeysAndTextInput.RepressSpeed)
            .Append("\n RepeatKeyAccelerationRatio ").Append(KeysAndTextInput.RepeatKeyAccelerationRatio)
            .Append("\n RepeatKeyMaxAccelerationRatio ").Append(KeysAndTextInput.RepeatKeyMaxAccelerationRatio)
            ;

            //if (Keyboard.GetState().IsKeyDown(Keys.F12))
            //    frameRate.ClearCollectionTrackingAndGcCollect();

            // display recorded characters.
            if (Keyboard.GetState().IsKeyDown(Keys.F7))
            {
                VisualKeyboardDisplay.DisplayRecordedTypedCharacters = true; // so it looks like spritebatch is the culprit here must be a buffer array resize kinda makes sense.
            }
            // hide recorded characters.
            if (Keyboard.GetState().IsKeyDown(Keys.F8))
            {
                VisualKeyboardDisplay.DisplayRecordedTypedCharacters = false;
            }

            if (Keyboard.GetState().NumLock)
            {
                this.IsFixedTimeStep = true;
            }
            else
            {
                this.IsFixedTimeStep = false;
            }

            base.Update(gameTime);
        }