NScumm.MonoGame.InputState.IsNewKeyPress C# (CSharp) Method

IsNewKeyPress() public method

Helper for checking if a key was newly pressed during this update.
public IsNewKeyPress ( Keys key ) : bool
key Keys
return bool
        public bool IsNewKeyPress(Keys key)
        {
            return (CurrentKeyboardState.IsKeyDown(key) &&
            LastKeyboardState.IsKeyUp(key));
        }

Usage Example

Example #1
0
 public override void HandleInput(InputState input)
 {
     if (input.IsNewKeyPress(Keys.Enter) && input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl))
     {
         var gdm = ((ScummGame)game).GraphicsDeviceManager;
         gdm.ToggleFullScreen();
         gdm.ApplyChanges();
     }
     else if (input.IsNewKeyPress(Keys.Space))
     {
         engine.IsPaused = !engine.IsPaused;
     }
     else
     {
         inputManager.UpdateInput(input.CurrentKeyboardState);
         cursorPos = inputManager.RealPosition;
         base.HandleInput(input);
     }
 }
All Usage Examples Of NScumm.MonoGame.InputState::IsNewKeyPress