Пример #1
0
 public KeyOrButton(string stringRepresentation)
 {
     if (stringRepresentation.Contains(' ') && !stringRepresentation.Contains(", "))
     {
         var split = stringRepresentation.Split(new char[] { ' ' }, 2);
         Button   = new GamepadButton(split[1], split[0]);
         IsButton = true;
     }
     else
     {
         Key   = (Keys)Enum.Parse(typeof(Keys), stringRepresentation, true);
         IsKey = true;
     }
 }
Пример #2
0
 public KeyOrButton(string stringRepresentation)
 {
     if (stringRepresentation.Contains(' ') && !stringRepresentation.Contains(", "))
     {
         var split = stringRepresentation.Split(new char[] { ' ' }, 2);
         Button = new GamepadButton(split[1], split[0]);
         IsButton = true;
     }
     else
     {
         Key = (Keys)Enum.Parse(typeof(Keys), stringRepresentation, true);
         IsKey = true;
     }
 }
Пример #3
0
        void GamepadHook_ButtonPressed(object sender, GamepadButton e)
        {
            if (AnyGamepadButtonPressed != null)
            {
                AnyGamepadButtonPressed(this, e);
            }

            if (RegisteredButtons.Contains(e))
            {
                if (ButtonPressed != null)
                {
                    ButtonPressed(this, e);
                }

                if (KeyOrButtonPressed != null)
                {
                    KeyOrButtonPressed(this, new KeyOrButton(e));
                }
            }
        }
Пример #4
0
 public KeyOrButton(GamepadButton button)
 {
     Button   = button;
     IsButton = true;
 }
Пример #5
0
 public void RegisterGamepadButton(GamepadButton button)
 {
     RegisteredButtons.Add(button);
 }
Пример #6
0
 public KeyOrButton(GamepadButton button)
 {
     Button = button;
     IsButton = true;
 }
Пример #7
0
 public void RegisterGamepadButton(GamepadButton button)
 {
     RegisteredButtons.Add(button);
 }
Пример #8
0
        void GamepadHook_ButtonPressed(object sender, GamepadButton e)
        {
            AnyGamepadButtonPressed?.Invoke(this, e);

            if (RegisteredButtons.Contains(e))
            {
                ButtonPressed?.Invoke(this, e);
                KeyOrButtonPressed?.Invoke(this, new KeyOrButton(e));
            }
        }
Пример #9
0
        void GamepadHook_ButtonPressed(object sender, GamepadButton e)
        {
            if (AnyGamepadButtonPressed != null)
                AnyGamepadButtonPressed(this, e);

            if (RegisteredButtons.Contains(e))
            {
                if (ButtonPressed != null)
                    ButtonPressed(this, e);

                if (KeyOrButtonPressed != null)
                    KeyOrButtonPressed(this, new KeyOrButton(e));
            }
        }