public static HalfController GetNew(int player, FullPadMode mode = FullPadMode.spellMode) { bool win = false; HalfController h = new HalfController(player, ref win, mode); return(win ? h : null); }
private HalfController(int player, ref bool assign, FullPadMode mode = FullPadMode.spellMode) { halfControllers.Add(this); this.fullPadMode = mode; this.playerNum = player; assign = reassign(); }
public static HalfController GetNew(int player, FullPadMode mode = FullPadMode.spellMode) { bool win = false; HalfController h = new HalfController(player, ref win, mode); return win ? h : null; }
public HalfPadState(FullPadMode mode, PlayerIndex controllerIndex) { GamePadState gamePadState = GamePad.GetState(controllerIndex, GamePadDeadZone.Circular); if (mode == FullPadMode.mirrorMode) { stick1 = new Stick(gamePadState.Buttons.Y, gamePadState.Buttons.A, gamePadState.Buttons.X, gamePadState.Buttons.B); if (stick1.isCentered()) { stick1 = new Stick(gamePadState.ThumbSticks.Left); } stick2 = new Stick(gamePadState.ThumbSticks.Right); if (stick2.isCentered()) { stick2 = new Stick(gamePadState.DPad.Up, gamePadState.DPad.Down, gamePadState.DPad.Left, gamePadState.DPad.Right); } Btn1 = gamePadState.Buttons.RightShoulder; if (Btn1 == ButtonState.Released) Btn1 = gamePadState.Buttons.LeftShoulder; Btn2 = (gamePadState.Triggers.Right < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; //TODO: test if (Btn2 == ButtonState.Released) Btn2 = (gamePadState.Triggers.Left < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; Btn2AsTrigger = Math.Max(gamePadState.Triggers.Right, gamePadState.Triggers.Left); Btn3 = gamePadState.Buttons.RightStick; if (Btn3 == ButtonState.Released) Btn3 = gamePadState.Buttons.LeftStick; BtnStart = gamePadState.Buttons.Start; if (BtnStart == ButtonState.Released) BtnStart = gamePadState.Buttons.Back; } else { stick1 = new Stick(gamePadState.ThumbSticks.Left); stick2 = new Stick(gamePadState.ThumbSticks.Right); if (stick2.isCentered()) { stick2 = new Stick(gamePadState.DPad.Up, gamePadState.DPad.Down, gamePadState.DPad.Left, gamePadState.DPad.Right); } Btn1 = gamePadState.Buttons.RightShoulder; if (Btn1 == ButtonState.Released) Btn1 = gamePadState.Buttons.LeftShoulder; if (Btn1 == ButtonState.Released) Btn1 = gamePadState.Buttons.A; Btn2 = (gamePadState.Triggers.Right < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; //TODO: test if (Btn2 == ButtonState.Released) Btn2 = (gamePadState.Triggers.Left < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; if (Btn2 == ButtonState.Released) Btn2 = gamePadState.Buttons.B; if (Btn2 == ButtonState.Released) Btn2 = gamePadState.Buttons.Y; Btn2AsTrigger = Math.Max(gamePadState.Triggers.Right, gamePadState.Triggers.Left); if (gamePadState.Buttons.B == ButtonState.Pressed || gamePadState.Buttons.Y == ButtonState.Pressed) Btn2AsTrigger = 1.0f; Btn3 = gamePadState.Buttons.RightStick; if (Btn3 == ButtonState.Released) Btn3 = gamePadState.Buttons.LeftStick; if (Btn3 == ButtonState.Released) Btn3 = gamePadState.Buttons.X; BtnStart = gamePadState.Buttons.Start; if (BtnStart == ButtonState.Released) BtnStart = gamePadState.Buttons.Back; } }
public HalfPadState(FullPadMode mode, PlayerIndex controllerIndex) { GamePadState gamePadState = GamePad.GetState(controllerIndex, GamePadDeadZone.Circular); if (mode == FullPadMode.mirrorMode) { stick1 = new Stick(gamePadState.Buttons.Y, gamePadState.Buttons.A, gamePadState.Buttons.X, gamePadState.Buttons.B); if (stick1.isCentered()) { stick1 = new Stick(gamePadState.ThumbSticks.Left); } stick2 = new Stick(gamePadState.ThumbSticks.Right); if (stick2.isCentered()) { stick2 = new Stick(gamePadState.DPad.Up, gamePadState.DPad.Down, gamePadState.DPad.Left, gamePadState.DPad.Right); } Btn1 = gamePadState.Buttons.RightShoulder; if (Btn1 == ButtonState.Released) { Btn1 = gamePadState.Buttons.LeftShoulder; } Btn2 = (gamePadState.Triggers.Right < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; //TODO: test if (Btn2 == ButtonState.Released) { Btn2 = (gamePadState.Triggers.Left < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; } Btn2AsTrigger = Math.Max(gamePadState.Triggers.Right, gamePadState.Triggers.Left); Btn3 = gamePadState.Buttons.RightStick; if (Btn3 == ButtonState.Released) { Btn3 = gamePadState.Buttons.LeftStick; } BtnStart = gamePadState.Buttons.Start; if (BtnStart == ButtonState.Released) { BtnStart = gamePadState.Buttons.Back; } } else { stick1 = new Stick(gamePadState.ThumbSticks.Left); stick2 = new Stick(gamePadState.ThumbSticks.Right); if (stick2.isCentered()) { stick2 = new Stick(gamePadState.DPad.Up, gamePadState.DPad.Down, gamePadState.DPad.Left, gamePadState.DPad.Right); } Btn1 = gamePadState.Buttons.RightShoulder; if (Btn1 == ButtonState.Released) { Btn1 = gamePadState.Buttons.LeftShoulder; } if (Btn1 == ButtonState.Released) { Btn1 = gamePadState.Buttons.A; } Btn2 = (gamePadState.Triggers.Right < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; //TODO: test if (Btn2 == ButtonState.Released) { Btn2 = (gamePadState.Triggers.Left < Controller.deadZone) ? ButtonState.Released : ButtonState.Pressed; } if (Btn2 == ButtonState.Released) { Btn2 = gamePadState.Buttons.B; } if (Btn2 == ButtonState.Released) { Btn2 = gamePadState.Buttons.Y; } Btn2AsTrigger = Math.Max(gamePadState.Triggers.Right, gamePadState.Triggers.Left); if (gamePadState.Buttons.B == ButtonState.Pressed || gamePadState.Buttons.Y == ButtonState.Pressed) { Btn2AsTrigger = 1.0f; } Btn3 = gamePadState.Buttons.RightStick; if (Btn3 == ButtonState.Released) { Btn3 = gamePadState.Buttons.LeftStick; } if (Btn3 == ButtonState.Released) { Btn3 = gamePadState.Buttons.X; } BtnStart = gamePadState.Buttons.Start; if (BtnStart == ButtonState.Released) { BtnStart = gamePadState.Buttons.Back; } } }