示例#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);
        }
示例#2
0
 public static bool HasButton(this XInputGamepadButton buttons, XInputGamepadButton button)
 {
     return((ushort)(buttons & button) == 1);
 }