public PovState getPov(int povCode) { if (povCode != 0) { throw new NotSupportedException(); } var state = GamePad.GetState(povCode).DPad; PovState povState = PovState.CENTER; if (state.Down == ButtonState.Pressed) { povState = PovState.SOUTH; } if (state.Up == ButtonState.Pressed) { povState = PovState.NORTH; } if (state.Left == ButtonState.Pressed) { if (povState == PovState.NORTH) { povState = PovState.NORTH_WEST; } else if (povState == PovState.SOUTH) { povState = PovState.SOUTH_WEST; } else { povState = PovState.WEST; } } if (state.Right == ButtonState.Pressed) { if (povState == PovState.NORTH) { povState = PovState.NORTH_EAST; } else if (povState == PovState.SOUTH) { povState = PovState.SOUTH_EAST; } else { povState = PovState.EAST; } } return(povState); }
void O_M_C_Input_GamePadListener.onPovChanged(GamePad gamePad, int povCode, PovState povState) { if (povState.isPressed(PovState.NORTH_) != _prevPovState.isPressed(PovState.NORTH_)) { if (povState.isPressed(PovState.NORTH_)) { notifyButtonDown(PS4Button.UP_); } else { notifyButtonUp(PS4Button.UP_); } } if (povState.isPressed(PovState.SOUTH_) != _prevPovState.isPressed(PovState.SOUTH_)) { if (povState.isPressed(PovState.SOUTH_)) { notifyButtonDown(PS4Button.DOWN_); } else { notifyButtonUp(PS4Button.DOWN_); } } if (povState.isPressed(PovState.EAST_) != _prevPovState.isPressed(PovState.EAST_)) { if (povState.isPressed(PovState.EAST_)) { notifyButtonDown(PS4Button.RIGHT_); } else { notifyButtonUp(PS4Button.RIGHT_); } } if (povState.isPressed(PovState.WEST_) != _prevPovState.isPressed(PovState.WEST_)) { if (povState.isPressed(PovState.WEST_)) { notifyButtonDown(PS4Button.LEFT_); } else { notifyButtonUp(PS4Button.LEFT_); } } _prevPovState = povState; }
public override void onPovChanged(GamePad gamePad, int povCode, PovState povState) { if (povState.isPressed(PovState.NORTH) != _prevPovState.isPressed(PovState.NORTH)) { if (povState.isPressed(PovState.NORTH)) { notifyButtonDown(PS4Button.UP); } else { notifyButtonUp(PS4Button.UP); } } if (povState.isPressed(PovState.SOUTH) != _prevPovState.isPressed(PovState.SOUTH)) { if (povState.isPressed(PovState.SOUTH)) { notifyButtonDown(PS4Button.DOWN); } else { notifyButtonUp(PS4Button.DOWN); } } if (povState.isPressed(PovState.EAST) != _prevPovState.isPressed(PovState.EAST)) { if (povState.isPressed(PovState.EAST)) { notifyButtonDown(PS4Button.RIGHT); } else { notifyButtonUp(PS4Button.RIGHT); } } if (povState.isPressed(PovState.WEST) != _prevPovState.isPressed(PovState.WEST)) { if (povState.isPressed(PovState.WEST)) { notifyButtonDown(PS4Button.LEFT); } else { notifyButtonUp(PS4Button.LEFT); } } _prevPovState = povState; }
public MonoGamePS4GamePad(GamePad gamePad) : base() { base._init_(gamePad); _prevPovState = gamePad.getPov(0); }
public MonoGamePS4GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base() { base._init_(gamePad, leftStickDeadZone, rightStickDeadZone); _prevPovState = gamePad.getPov(0); }
public MonoGamePS4GamePad(GamePad gamePad) : base(gamePad) { _prevPovState = gamePad.getPov(0); }
public MonoGameXbox360GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base(gamePad, leftStickDeadZone, rightStickDeadZone) { _prevPovState = gamePad.getPov(0); }