/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="type">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> public static UniversalControlState Getter(UniversalControl c, UniversalControlType type, byte num) { switch (type) { case UniversalControlType.XInputGamepad: return(StateXInput(c, num)); case UniversalControlType.DirectInputGamepad: return(StateDirectInput(c, num)); case UniversalControlType.Keyboard: return(StateKeyboard(c, num)); } return(new UniversalControlState()); }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> private static UniversalControlState StateDirectInput(UniversalControl c, byte num) { var t = DX.GetJoypadInputState(num); return(new UniversalControlState { A = (t & c.RemappedA) != 0, B = (t & c.RemappedB) != 0, X = (t & c.RemappedX) != 0, Y = (t & c.RemappedY) != 0, L = (t & c.RemappedL) != 0, R = (t & c.RemappedR) != 0, Left = (t & c.RemappedLeft) != 0, Right = (t & c.RemappedRight) != 0, Up = (t & c.RemappedUp) != 0, Down = (t & c.RemappedDown) != 0, Start = (t & c.RemappedStart) != 0, Back = (t & c.RemappedBack) != 0, }); }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> private static UniversalControlState StateXInput(UniversalControl c, byte num) { var s = c.XInputInstance.GetState().Gamepad; return(new UniversalControlState { //最近は便利なメソッドがあるもんですね A = s.Buttons.HasFlag(XInputButtonKind.A), B = s.Buttons.HasFlag(XInputButtonKind.B), X = s.Buttons.HasFlag(XInputButtonKind.X), Y = s.Buttons.HasFlag(XInputButtonKind.Y), L = s.Buttons.HasFlag(XInputButtonKind.LeftShoulder), R = s.Buttons.HasFlag(XInputButtonKind.RightShoulder), Left = s.Buttons.HasFlag(XInputButtonKind.DigitalPadLeft), Right = s.Buttons.HasFlag(XInputButtonKind.DigitalPadRight), Up = s.Buttons.HasFlag(XInputButtonKind.DigitalPadUp), Down = s.Buttons.HasFlag(XInputButtonKind.DigitalPadDown), Start = s.Buttons.HasFlag(XInputButtonKind.Start), Back = s.Buttons.HasFlag(XInputButtonKind.Back), }); }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> private static UniversalControlState StateXInput(UniversalControl c, byte num) { var s = c.XInputInstance.GetState().Gamepad; return new UniversalControlState { //最近は便利なメソッドがあるもんですね A = s.Buttons.HasFlag(XInputButtonKind.A), B = s.Buttons.HasFlag(XInputButtonKind.B), X = s.Buttons.HasFlag(XInputButtonKind.X), Y = s.Buttons.HasFlag(XInputButtonKind.Y), L = s.Buttons.HasFlag(XInputButtonKind.LeftShoulder), R = s.Buttons.HasFlag(XInputButtonKind.RightShoulder), Left = s.Buttons.HasFlag(XInputButtonKind.DigitalPadLeft), Right = s.Buttons.HasFlag(XInputButtonKind.DigitalPadRight), Up = s.Buttons.HasFlag(XInputButtonKind.DigitalPadUp), Down = s.Buttons.HasFlag(XInputButtonKind.DigitalPadDown), Start = s.Buttons.HasFlag(XInputButtonKind.Start), Back = s.Buttons.HasFlag(XInputButtonKind.Back), }; }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> private static UniversalControlState StateDirectInput(UniversalControl c, byte num) { var t = DX.GetJoypadInputState(num); return new UniversalControlState { A = (t & c.RemappedA) != 0, B = (t & c.RemappedB) != 0, X = (t & c.RemappedX) != 0, Y = (t & c.RemappedY) != 0, L = (t & c.RemappedL) != 0, R = (t & c.RemappedR) != 0, Left = (t & c.RemappedLeft) != 0, Right = (t & c.RemappedRight) != 0, Up = (t & c.RemappedUp) != 0, Down = (t & c.RemappedDown) != 0, Start = (t & c.RemappedStart) != 0, Back = (t & c.RemappedBack) != 0, }; }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> public static UniversalControlState StateKeyboard(UniversalControl c, byte num) { return new UniversalControlState(); }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="type">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> public static UniversalControlState Getter(UniversalControl c, UniversalControlType type, byte num) { switch (type) { case UniversalControlType.XInputGamepad: return StateXInput(c, num); case UniversalControlType.DirectInputGamepad: return StateDirectInput(c, num); case UniversalControlType.Keyboard: return StateKeyboard(c, num); } return new UniversalControlState(); }
/// <summary> /// 特になし /// </summary> /// <param name="c">特になし</param> /// <param name="num">特になし</param> /// <returns>特になし</returns> public static UniversalControlState StateKeyboard(UniversalControl c, byte num) { return(new UniversalControlState()); }