Example #1
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            keyboard.Update();
            gamePadHandler.Update();

            if (allowsExiting)
            {
                if (keyboard.IsKeyDown(Keys.Escape))
                {
                    Game.Exit();
                }

                // Allows the default game to exit on Xbox 360 and Windows
                if (gamePadHandler.WasButtonPressed(0, Buttons.Back))
                {
                    Game.Exit();
                }
            }



#if !XBOX360
            prevMouseState = mouseState;
            mouseState     = Mouse.GetState();
#endif

            base.Update(gameTime);
        }
Example #2
0
        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            keyboard.Update();
            gamePadHandler.Update();

            if (keyboard.IsKeyDown(Keys.Escape))
            {
                Game.Exit();
            }

            if (gamePadHandler.WasButtonPressed(0, Buttons.Back))
            {
                Game.Exit();
            }


#if !XBOX360
            prevMouseState = mouseState;
            mouseState     = Mouse.GetState();
#endif

            base.Update(gameTime);
        }