コード例 #1
0
        /// <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)
        {
            // update the game systems
            double dt = (double)gameTime.ElapsedGameTime.Milliseconds * 0.001;

            world.Update(dt);

            // update the UI
            diagnostics.RestartTiming("UI");
            world.UI.Update(gameTime);
            diagnostics.StopTiming("UI");

            _updateDiagnosticsCountdown -= gameTime.ElapsedGameTime.Milliseconds;
            if (_updateDiagnosticsCountdown <= 0)
            {
                _updateDiagnosticsCountdown += _updateDiagnosticsRate;
                ((DrawableText)diagnosticEntity.Get <DrawableComponent>().Drawables["Text"][0]).Text = diagnostics.ShowTop(8, true);
            }

            base.Update(gameTime);
        }