Exemplo n.º 1
0
        private void ProcessInput(GameTime gameTime)
        {
            // This fixes the issue of clicking through windows
            //if (!IsActive)
            //    return;

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            _inputInformation.PreviousGamePadState  = _inputInformation.CurrentGamePadState;
            _inputInformation.PreviousKeyboardState = _inputInformation.CurrentKeyboardState;
            _inputInformation.PreviousMouseState    = _inputInformation.CurrentMouseState;

            _inputInformation.CurrentKeyboardState = Keyboard.GetState();
            _inputInformation.CurrentGamePadState  = GamePad.GetState(PlayerIndex.One);
            _inputInformation.CurrentMouseState    = Mouse.GetState();

            switch (_appType)
            {
            case ApplicationType.None:
                _mainMenu.ProcessInput(gameTime, _inputInformation);
                break;

            case ApplicationType.Client:
                _client.ProcessInput(gameTime, _inputInformation);
                break;

            case ApplicationType.Server:
                _server.ProcessInput(gameTime, _inputInformation);
                break;
            }
        }