public void Commit(ulong updateTick, float deltaTime) { int controlCount = Controls.Length; for (int i = 0; i < controlCount; i++) { var control = Controls[i]; if (control != null) { control.Commit(); if (control.HasChanged) { LastChangeTick = updateTick; } } } if (IsKnown) { GetControl(InputControlType.Command).CommitWithState(AnyCommandControlIsPressed(), updateTick, deltaTime); } LeftStickX.CommitWithSides(LeftStickLeft, LeftStickRight, updateTick, deltaTime); LeftStickY.CommitWithSides(LeftStickDown, LeftStickUp, updateTick, deltaTime, InputManager.InvertYAxis); LeftStick.UpdateWithAxes(LeftStickX, LeftStickY, updateTick, deltaTime); RightStickX.CommitWithSides(RightStickLeft, RightStickRight, updateTick, deltaTime); RightStickY.CommitWithSides(RightStickDown, RightStickUp, updateTick, deltaTime, InputManager.InvertYAxis); RightStick.UpdateWithAxes(RightStickX, RightStickY, updateTick, deltaTime); DPadX.CommitWithSides(DPadLeft, DPadRight, updateTick, deltaTime); DPadY.CommitWithSides(DPadDown, DPadUp, updateTick, deltaTime, InputManager.InvertYAxis); DPad.UpdateWithAxes(DPadX, DPadY, updateTick, deltaTime); }
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); }
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); }