Microsoft.Xna.Framework.Input.Keyboard.GetState C# (CSharp) Method

GetState() public static method

public static GetState ( ) : KeyboardState
return KeyboardState
        public static KeyboardState GetState() { return default(KeyboardState); }
    }

Usage Example

Example #1
0
        /// <summary>
        /// Processes keystrokes.
        /// </summary>
        /// <param name="gameTime"></param>
        private void ProcessInput(GameTime gameTime)
        {
            if (_backspaceheld)
            {
                _deleteTimer -= gameTime.ElapsedGameTime;
                if (_deleteTimer <= TimeSpan.Zero)
                {
                    _deleteNextChar = true;
                }
            }

            _currentKeyboardState = Keyboard.GetState();

            if ((_currentKeyboardState.IsKeyDown(Keys.RightShift) ||
                 _currentKeyboardState.IsKeyDown(Keys.LeftShift)) && !_keyShiftTimerStarted)
            {
                _keyShiftTimer = TimeSpan.FromSeconds(0.1);
                _keyShift      = true;
            }

            if (_keyShift)
            {
                _keyShiftTimer -= gameTime.ElapsedGameTime;
                if (_keyShiftTimer <= TimeSpan.Zero)
                {
                    _keyShift             = false;
                    _keyShiftTimerStarted = false;
                }
            }

            if (IsFocused)
            {
                ProcessKeyboard();
            }
        }
All Usage Examples Of Microsoft.Xna.Framework.Input.Keyboard::GetState
Keyboard