Exemple #1
0
        internal void ProcessLeftStick()
        {
            var x = Utility.ValueFromSides(LeftStickLeft.NextRawValue, LeftStickRight.NextRawValue);
            var y = Utility.ValueFromSides(LeftStickDown.NextRawValue, LeftStickUp.NextRawValue, InputManager.InvertYAxis);

            Vector2 v;

            if (RawSticks)
            {
                v = new Vector2(x, y);
            }
            else
            {
                var lowerDeadZone = Utility.Max(LeftStickLeft.LowerDeadZone, LeftStickRight.LowerDeadZone, LeftStickUp.LowerDeadZone, LeftStickDown.LowerDeadZone);
                var upperDeadZone = Utility.Min(LeftStickLeft.UpperDeadZone, LeftStickRight.UpperDeadZone, LeftStickUp.UpperDeadZone, LeftStickDown.UpperDeadZone);
                v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone);
            }

            LeftStick.Raw = true;
            LeftStick.UpdateWithAxes(v.X, v.Y);

            LeftStickX.Raw = true;
            LeftStickX.CommitWithValue(v.X);

            LeftStickY.Raw = true;
            LeftStickY.CommitWithValue(v.Y);

            LeftStickLeft.SetValue(LeftStick.Left.Value);
            LeftStickRight.SetValue(LeftStick.Right.Value);
            LeftStickUp.SetValue(LeftStick.Up.Value);
            LeftStickDown.SetValue(LeftStick.Down.Value);
        }
        void ProcessLeftStick(ulong updateTick, float deltaTime)
        {
            var x = Utility.ValueFromSides(LeftStickLeft.NextRawValue, LeftStickRight.NextRawValue);
            var y = Utility.ValueFromSides(LeftStickDown.NextRawValue, LeftStickUp.NextRawValue, InputManager.InvertYAxis);

            Vector2 v;

            if (RawSticks || LeftStickLeft.Raw || LeftStickRight.Raw || LeftStickUp.Raw || LeftStickDown.Raw)
            {
                v = new Vector2(x, y);
            }
            else
            {
                var lowerDeadZone = Utility.Max(LeftStickLeft.LowerDeadZone, LeftStickRight.LowerDeadZone, LeftStickUp.LowerDeadZone, LeftStickDown.LowerDeadZone);
                var upperDeadZone = Utility.Min(LeftStickLeft.UpperDeadZone, LeftStickRight.UpperDeadZone, LeftStickUp.UpperDeadZone, LeftStickDown.UpperDeadZone);
                v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone);
            }

            LeftStick.Raw = true;
            LeftStick.UpdateWithAxes(v.x, v.y, updateTick, deltaTime);

            LeftStickX.Raw = true;
            LeftStickX.CommitWithValue(v.x, updateTick, deltaTime);

            LeftStickY.Raw = true;
            LeftStickY.CommitWithValue(v.y, updateTick, deltaTime);

            LeftStickLeft.SetValue(LeftStick.Left.Value, updateTick);
            LeftStickRight.SetValue(LeftStick.Right.Value, updateTick);
            LeftStickUp.SetValue(LeftStick.Up.Value, updateTick);
            LeftStickDown.SetValue(LeftStick.Down.Value, updateTick);
        }
Exemple #3
0
    void ProcessLeftStick(ulong updateTick, float deltaTime)
    {
        var x = Utility.ValueFromSides(LeftStickLeft.NextRawValue, LeftStickRight.NextRawValue);
        var y = Utility.ValueFromSides(LeftStickDown.NextRawValue, LeftStickUp.NextRawValue, InputManager.InvertYAxis);

        Vector2 v;

        //if (RawSticks)
        //{
        v = new Vector2(x, y);
        //}


        //LeftStick.Raw = true;
        LeftStick.UpdateWithAxes(v.x, v.y, updateTick, deltaTime);

        //LeftStickX.Raw = true;
        LeftStickX.CommitWithValue(v.x, updateTick, deltaTime);

        //LeftStickY.Raw = true;
        LeftStickY.CommitWithValue(v.y, updateTick, deltaTime);

        LeftStickLeft.SetValue(LeftStick.Left.Value, updateTick);
        LeftStickRight.SetValue(LeftStick.Right.Value, updateTick);
        LeftStickUp.SetValue(LeftStick.Up.Value, updateTick);
        LeftStickDown.SetValue(LeftStick.Down.Value, updateTick);
    }