Sharpcraft.Sharpcraft.Update C# (CSharp) Method

Update() protected method

Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.
protected Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime Provides a snapshot of timing values.
return void
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                ToggleGameMenu();

            if (Keyboard.GetState().IsKeyUp(Keys.Escape))
                _menuToggling = false;

            if (!_gameMenuOpen && IsActive)
                Mouse.SetPosition(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);

            if (Keyboard.GetState().IsKeyDown(Keys.LeftAlt) && Keyboard.GetState().IsKeyDown(Keys.Enter))
                ToggleFullscreen();
            else
                _fullscreenToggling = false;

            base.Update(gameTime);
        }