コード例 #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)
        {
            base.Update(gameTime);
            GameTimes.UpdateTimes(gameTime);
            KeyInput.Update();

            _camera.Update();

            _currentState.Update();

            if (KeyInput.JustPressedKey(Keys.F12))
            {
                GlobalState.ShowFPS = !GlobalState.ShowFPS;
            }
        }
コード例 #2
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)
        {
            base.Update(gameTime);

            GameTimes.UpdateTimes(gameTime);
            KeyInput.Update();

            if (GlobalState.settings.pause_on_unfocus && !IsActive)
            {
                return;
            }

            _currentState.Update();

            _camera.Update();

            foreach (var effect in GlobalState.AllEffects.Where(e => e.Active()))
            {
                effect.Update();
            }

            if (KeyInput.JustPressedKey(Keys.F12))
            {
                GlobalState.ShowFPS = !GlobalState.ShowFPS;
            }

            if (GlobalState.ClosingGame)
            {
                Exit();
            }

            if (GlobalState.ResolutionDirty)
            {
                InitGraphics();
                GlobalState.ResolutionDirty = false;
            }
        }