Exemple #1
0
        private void StickAxisUpdate(JoystickDoubleAxis axis)
        {
            float x = axis.GetAxisX();
            float y = axis.GetAxisY();

            // Checks if input is below dead, if not it can continue, overwise it should set axis values to 0
            if (IsInDead(x, axis.DeadZoneX) && IsInDead(y, axis.DeadZoneY))
            {
                axis.X       = 0;
                axis.Y       = 0;
                axis.XChange = false;
                axis.YChange = false;
                stickInput.OnStickDeadZone(axis);
                return;
            }
            // Setting new x and y value to axis
            axis.X = x;
            axis.Y = y;
            // Call hold method
            stickInput.OnStickHold(axis);
            // Should call hold change it when position of x or y changes
            axis.XChange = axis.Dx != 0;
            axis.YChange = axis.Dy != 0;
            if (axis.HasAnyChanged())
            {
                stickInput.OnStickChange(axis);
            }
        }
Exemple #2
0
        private void ArrowsAxisUpdate(JoystickDoubleAxis axis)
        {
            float x = axis.GetAxisX();
            float y = axis.GetAxisY();

            // Setting new x and y value to axis
            axis.X = x;
            axis.Y = y;
            if (axis.X == 0 && axis.Y == 0)
            {
                arrowsInput.OnArrowsDeadZone(axis);
                return;
            }
            // Call hold method
            arrowsInput.OnArrowsHold(axis);
            // Should call hold change it when position of x or y changes
            axis.XChange = axis.Dx != 0;
            axis.YChange = axis.Dy != 0;
            if (axis.HasAnyChanged())
            {
                arrowsInput.OnArrowsChange(axis);
            }
        }
Exemple #3
0
 private void SetupArrows(string horizontal_arrows, string vertical_arrows)
 {
     arrows = new JoystickDoubleAxis(this, horizontal_arrows, vertical_arrows, AxisCode.Arrows, ArrowsX, ArrowsY);
 }
Exemple #4
0
 private void SetupSticks(string left_x_stick, string left_y_stick,
                          string right_x_stick, string right_y_stick)
 {
     leftStick  = new JoystickDoubleAxis(this, left_x_stick, left_y_stick, AxisCode.LeftStick, LSx, LSy);
     rightStick = new JoystickDoubleAxis(this, right_x_stick, right_y_stick, AxisCode.RightStick, RSx, RSy);
 }