public override void onAxisChanged(GamePad gamePad, int axisCode, float axisValue)
        {
            switch ((MonoGameGamePad.AxisCodes)axisCode)
            {
            case MonoGameGamePad.AxisCodes.LeftThumbstickX:
                notifyLeftStickXMoved(axisValue);
                break;

            case MonoGameGamePad.AxisCodes.LeftThumbstickY:
                notifyLeftStickYMoved(axisValue);
                break;

            case MonoGameGamePad.AxisCodes.RightThumbstickX:
                notifyRightStickXMoved(axisValue);
                break;

            case MonoGameGamePad.AxisCodes.RightThumbstickY:
                notifyRightStickYMoved(axisValue);
                break;

            case MonoGameGamePad.AxisCodes.LeftTrigger:
                notifyL2Moved(axisValue);
                break;

            case MonoGameGamePad.AxisCodes.RightTrigger:
                notifyR2Moved(axisValue);
                break;
            }
        }
        public override void onButtonDown(GamePad gamePad, int buttonCode)
        {
            var button = buttonCodeToPS4Button(buttonCode);

            if (button != null)
            {
                notifyButtonDown(button);
            }
        }
Exemple #3
0
        public override void onButtonUp(GamePad gamePad, int buttonCode)
        {
            var button = buttonCodeToXBox360Button(buttonCode);

            if (button != null)
            {
                notifyButtonUp(button);
            }
        }
        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 override void onDisconnect(GamePad gamePad)
 {
     notifyDisconnected();
 }
 public override void onConnect(GamePad gamePad)
 {
     notifyConnected();
 }
 public MonoGamePS4GamePad(GamePad gamePad) : base(gamePad)
 {
     _prevPovState = gamePad.getPov(0);
 }
 public MonoGamePS4GamePad(GamePad gamePad, DeadZone leftStickDeadZone, DeadZone rightStickDeadZone) : base(gamePad, leftStickDeadZone, rightStickDeadZone)
 {
     _prevPovState = gamePad.getPov(0);
 }
 public override void onAccelerometerChanged(GamePad gamePad, int accelerometerCode, Vector3 value)
 {
 }