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); }
void ProcessDPad(ulong updateTick, float deltaTime) { var x = Utility.ValueFromSides(DPadLeft.NextRawValue, DPadRight.NextRawValue); var y = Utility.ValueFromSides(DPadDown.NextRawValue, DPadUp.NextRawValue, InputManager.InvertYAxis); Vector2 v; if (RawSticks || DPadLeft.Raw || DPadRight.Raw || DPadUp.Raw || DPadDown.Raw) { v = new Vector2(x, y); } else { var lowerDeadZone = Utility.Max(DPadLeft.LowerDeadZone, DPadRight.LowerDeadZone, DPadUp.LowerDeadZone, DPadDown.LowerDeadZone); var upperDeadZone = Utility.Min(DPadLeft.UpperDeadZone, DPadRight.UpperDeadZone, DPadUp.UpperDeadZone, DPadDown.UpperDeadZone); v = Utility.ApplySeparateDeadZone(x, y, lowerDeadZone, upperDeadZone); } DPad.Raw = true; DPad.UpdateWithAxes(v.x, v.y, updateTick, deltaTime); DPadX.Raw = true; DPadX.CommitWithValue(v.x, updateTick, deltaTime); DPadY.Raw = true; DPadY.CommitWithValue(v.y, updateTick, deltaTime); DPadLeft.SetValue(DPad.Left.Value, updateTick); DPadRight.SetValue(DPad.Right.Value, updateTick); DPadUp.SetValue(DPad.Up.Value, updateTick); DPadDown.SetValue(DPad.Down.Value, updateTick); }
public void ClearInputState() { LeftStickX.ClearInputState(); LeftStickY.ClearInputState(); LeftStick.ClearInputState(); RightStickX.ClearInputState(); RightStickY.ClearInputState(); RightStick.ClearInputState(); DPadX.ClearInputState(); DPadY.ClearInputState(); DPad.ClearInputState(); var controlCount = Controls.Length; for (int i = 0; i < controlCount; i++) { var control = Controls[i]; if (control != null) { control.ClearInputState(); } } }
internal void ProcessDPad() { var lowerDeadZone = Utility.Max(DPadLeft.LowerDeadZone, DPadRight.LowerDeadZone, DPadUp.LowerDeadZone, DPadDown.LowerDeadZone); var upperDeadZone = Utility.Min(DPadLeft.UpperDeadZone, DPadRight.UpperDeadZone, DPadUp.UpperDeadZone, DPadDown.UpperDeadZone); var x = Utility.ValueFromSides(DPadLeft.NextRawValue, DPadRight.NextRawValue); var y = Utility.ValueFromSides(DPadDown.NextRawValue, DPadUp.NextRawValue, InputManager.InvertYAxis); var v = Utility.ApplyCircularDeadZone(x, y, lowerDeadZone, upperDeadZone); DPad.Raw = true; DPad.UpdateWithAxes(v.X, v.Y); DPadX.Raw = true; DPadX.CommitWithValue(v.X); DPadY.Raw = true; DPadY.CommitWithValue(v.Y); DPadLeft.SetValue(DPad.Left.Value); DPadRight.SetValue(DPad.Right.Value); DPadUp.SetValue(DPad.Up.Value); DPadDown.SetValue(DPad.Down.Value); }