diff options
| author | Jacob Palecki <[email protected]> | 2020-09-25 22:21:26 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-25 22:21:26 -0700 |
| commit | 70360dd3c19909737d29c0b2b9fb1a7ba3f12bba (patch) | |
| tree | 345c3329330271145e67733a1a9ca79ebf00448c | |
| parent | Fix 0 point for separate x y sens (diff) | |
| download | rawaccel-70360dd3c19909737d29c0b2b9fb1a7ba3f12bba.tar.xz rawaccel-70360dd3c19909737d29c0b2b9fb1a7ba3f12bba.zip | |
Last mouse move perfetly responsive at 100 FPS
| -rw-r--r-- | grapher/Form1.cs | 2 | ||||
| -rw-r--r-- | grapher/Models/AccelGUI.cs | 19 | ||||
| -rw-r--r-- | grapher/Models/Charts/AccelCharts.cs | 5 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartState/ChartState.cs | 7 | ||||
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 9 | ||||
| -rw-r--r-- | grapher/Models/Mouse/MouseWatcher.cs | 8 |
6 files changed, 48 insertions, 2 deletions
diff --git a/grapher/Form1.cs b/grapher/Form1.cs index 3f2ca2a..aa3d2ef 100644 --- a/grapher/Form1.cs +++ b/grapher/Form1.cs @@ -144,7 +144,7 @@ namespace grapher private void RawAcceleration_Paint(object sender, PaintEventArgs e) { - AccelGUI.AccelCharts.DrawLastMovement(); + //AccelGUI.AccelCharts.DrawLastMovement(); } #endregion Method diff --git a/grapher/Models/AccelGUI.cs b/grapher/Models/AccelGUI.cs index dd394c5..131df9c 100644 --- a/grapher/Models/AccelGUI.cs +++ b/grapher/Models/AccelGUI.cs @@ -38,6 +38,7 @@ namespace grapher WriteButton.Click += new System.EventHandler(OnWriteButtonClick); ButtonTimer = SetupButtonTimer(); + ChartRefresh = SetupChartTimer(); SetupWriteButton(); } @@ -63,6 +64,8 @@ namespace grapher public ToolStripMenuItem ScaleMenuItem { get; } + private Timer ChartRefresh { get; } + #endregion Properties #region Methods @@ -110,6 +113,15 @@ namespace grapher ApplyOptions.SetActiveValues(settings); } + private Timer SetupChartTimer() + { + Timer chartTimer = new Timer(); + chartTimer.Enabled = true; + chartTimer.Interval = 10; + chartTimer.Tick += new System.EventHandler(OnChartTimerTick); + return chartTimer; + } + private Timer SetupButtonTimer() { Timer buttonTimer = new Timer(); @@ -159,6 +171,13 @@ namespace grapher ButtonTimer.Start(); } + private void OnChartTimerTick(object sender, EventArgs e) + { + AccelCharts.DrawLastMovement(); + MouseWatcher.UpdateLastMove(); + AccelCharts.Redraw(); + } + #endregion Methods } diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs index a0e99c8..7484a3a 100644 --- a/grapher/Models/Charts/AccelCharts.cs +++ b/grapher/Models/Charts/AccelCharts.cs @@ -143,6 +143,11 @@ namespace grapher AlignWriteButton(); } + public void Redraw() + { + ChartState.Redraw(); + } + public void Calculate(ManagedAccel accel, DriverSettings settings) { ChartState.SetUpCalculate(settings); diff --git a/grapher/Models/Charts/ChartState/ChartState.cs b/grapher/Models/Charts/ChartState/ChartState.cs index e1c7d01..1898e12 100644 --- a/grapher/Models/Charts/ChartState/ChartState.cs +++ b/grapher/Models/Charts/ChartState/ChartState.cs @@ -48,6 +48,13 @@ namespace grapher.Models.Charts.ChartState public abstract void Calculate(ManagedAccel accel, DriverSettings settings); + public void Redraw() + { + SensitivityChart.Update(); + VelocityChart.Update(); + GainChart.Update(); + } + public virtual void SetUpCalculate(DriverSettings settings) { Data.Clear(); diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index c30c993..3bd7601 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -154,6 +154,15 @@ namespace grapher */ } + public void Update() + { + ChartX.Update(); + if (ChartY.Visible) + { + ChartY.Update(); + } + } + public void SetPointBinds(PointData combined, PointData x, PointData y) { CombinedPointData = combined; diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index 86b1c2e..c6e85c1 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -716,10 +716,16 @@ namespace grapher.Models.Mouse public void OnMouseMove(int x, int y, double timeInMs) { - Display.Text = $"Last (x, y): ({x}, {y})"; + MouseData.Set(x,y); AccelCharts.MakeDots(x, y, timeInMs); } + public void UpdateLastMove() + { + MouseData.Get(out var x, out var y); + Display.Text = $"Last (x, y): ({x}, {y})"; + } + public void ReadMouseMove(Message message) { RawInput rawInput = new RawInput(); |