Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }