Esempio n. 1
0
 /// <summary>
 /// Responds to user input, changing the selected entry and accepting
 /// or cancelling the menu.
 /// </summary>
 public override void HandleInput(GameStateManagement.InputState input)
 {
     // Skip splash screen?
     if (input.CurrentKeyboardStates[0].IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Space) && input.LastKeyboardStates[0].IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
     {
         ScreenManager.AddScreen(new MenuScreen(), null);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(GameStateManagement.InputState input)
        {
            // Start game
            if (input.CurrentKeyboardStates[0].IsKeyUp(Keys.Space) && input.LastKeyboardStates[0].IsKeyDown(Keys.Space))
            {
                ScreenManager.AddScreen(new GameplayScreen(), null);
            }

            // Return to splash screen
            if (input.CurrentKeyboardStates[0].IsKeyUp(Keys.Escape) && input.LastKeyboardStates[0].IsKeyDown(Keys.Escape))
            {
                ScreenManager.AddScreen(new SplashScreen(), null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Lets the game respond to player input. Unlike the Update method,
        /// this will only be called when the gameplay screen is active.
        /// </summary>
        public override void HandleInput(GameStateManagement.InputState input)
        {
            KeyboardState keyboardState = input.CurrentKeyboardStates[0];
            GamePadState  gamePadState  = input.CurrentGamePadStates[0];

            // The game pauses either if the user presses the pause button, or if
            // they unplug the active gamepad. This requires us to keep track of
            // whether a gamepad was ever plugged in, because we don't want to pause
            // on PC if they are playing with a keyboard and have no gamepad at all!
            bool gamePadDisconnected = !gamePadState.IsConnected && input.GamePadWasConnected[0];

            // Otherwise move the player position.
            Vector2 movement = Vector2.Zero;

            if (keyboardState.IsKeyUp(Keys.Escape) && input.LastKeyboardStates[0].IsKeyDown(Keys.Escape))
            {
                ScreenManager.RemoveScreen(this);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Allows the screen to handle user input. Unlike Update, this method
 /// is only called when the screen is active, and not when some other
 /// screen has taken the focus.
 /// </summary>
 public virtual void HandleInput(InputState input)
 {
 }