Beispiel #1
0
        public static IEnumerable <XInputGamepadButton> GetIncludedButtons(this XInputGamepadButton buttons)
        {
            var result = new List <XInputGamepadButton>();

            foreach (XInputGamepadButton button in Enum.GetValues(typeof(XInputGamepadButton)))
            {
                if (buttons.HasFlag(button))
                {
                    result.Add(button);
                }
            }

            return(result);
        }
Beispiel #2
0
 public static bool HasButton(this XInputGamepadButton buttons, XInputGamepadButton button)
 {
     return((ushort)(buttons & button) == 1);
 }