Give access to the real-time state of the keyboard
Beispiel #1
0
 public static bool isKeyOverride(Keyboard.Key key)
 {
     if (PressedKeys.Contains(key.ToString()) &&
         !OldPressedKeys.Contains(key.ToString()))
         return true;
     return false;
 }
Beispiel #2
0
 public static bool isKeyTap(Keyboard.Key key)
 {
     if (!isActive)
         return false;
     if (PressedKeys.Contains(key.ToString()) &&
         !OldPressedKeys.Contains(key.ToString()))
         return true;
     return false;
 }
Beispiel #3
0
 private void Handler_AddMapping_OnKeyboardKeyDown(object sender, KeyEventArgs e)
 {
     foreach (Keyboard.Key key in Enum.GetValues(typeof(Keyboard.Key)).Cast <Keyboard.Key>())
     {
         if (Keyboard.IsKeyPressed(key))
         {
             Handler_AddMapping_GenericKeyDown(ExtraButtons.Unknown, key, MouseButton.Unknown);
         }
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StaticKeyCodeReference"/> class.
 /// </summary>
 /// <param name="key">The key.</param>
 public StaticKeyCodeReference(Keyboard.Key key)
 {
     _key = key;
 }
Beispiel #5
0
 public PressListener(Keyboard.Key key)
 {
     _key = key;
 }
Beispiel #6
0
 /// <summary>
 /// Adds the given window widget to the main window associated to a shortcut key
 /// </summary>
 /// <param name="window">Window to add</param>
 /// <param name="key">Shorcut key to show and hide the given window</param>
 public void AddWindow(WindowedWidget window, Keyboard.Key key)
 {
     Gui.AddWindow(window, true);
     Gui.AddKeyWindowBind(key, window);
 }
        /// <summary>returns true, if the key is not pressed this frame and was pressed previous frame</summary>
        /// <param name="key">Key to be evaluated</param>
        /// <returns>returns true, if the key is not pressed this frame and was pressed previous frame</returns>
        public static bool upward(Keyboard.Key key)
        {
            if (!isInitialized) { initialize(); }

            return previousKeyIsPressed[(int)key] && !currentKeyIsPressed[(int)key];
        }
 public static bool isPressed(Keyboard.Key key)
 {
     return currentKeyIsPressed[(int)key];
 }
Beispiel #9
0
 public KeyEvent(KeyStateChange type_, Keyboard.Key key_)
     : base(EventType.KeyEvent)
 {
     StateChange = type_;
     Key = key_;
 }
Beispiel #10
0
 public KeyInputArgs(Keyboard.Key key, bool pressed, bool control, bool shift)
 {
     Key = key;
     Pressed = pressed;
     Control = control;
     Shift = shift;
 }
Beispiel #11
0
 public static bool isKeyDownOverride(Keyboard.Key key)
 {
     return Keyboard.IsKeyPressed(key);
 }
Beispiel #12
0
 public virtual bool KeyPressed(Keyboard.Key key, string text)
 {
     return false;
 }
Beispiel #13
0
 public bool IsKeyPressed(Keyboard.Key key)
 {
     if (pressedKeys.Contains(key))
     {
         pressedKeys.Remove(key);
         return true;
     }
     return false;
 }
Beispiel #14
0
 public bool IsKeyHold(Keyboard.Key key)
 {
     return pressedKeys.Contains(key);
 }
 /// <summary>
 /// Changes the referened key.
 /// </summary>
 /// <param name="newValue">The new <see cref="Keyboard.Key"/>.</param>
 public void ChangeKey(Keyboard.Key newValue)
 {
     _key = newValue;
 }
 public static bool IsKeyPressed(Keyboard.Key key) => KeysPressed.Contains(key);
Beispiel #17
0
 public static bool isKeyUp(Keyboard.Key key)
 {
     if (!isActive)
         return false;
     return !Keyboard.IsKeyPressed(key);
 }
Beispiel #18
0
        public override bool KeyPressed(Keyboard.Key key, string text)
        {
            if (_focus == null)
                return false;

            return _focus.KeyPressed(key, text);
        }
Beispiel #19
0
        public KeyCombinationEvent(bool ctrl_,
								   bool shift_,
                                   Keyboard.Key key_)
            : base(EventType.KeyCombinationEvent)
        {
            Ctrl = ctrl_;
            Shift = shift_;
            Key = key_;
        }