示例#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));
            }
        }