diff options
| author | Jacob Palecki <[email protected]> | 2020-08-13 20:56:41 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-13 20:56:41 -0700 |
| commit | 32323636b4b5390c114fc2a6d845b7621a983cdc (patch) | |
| tree | 01d7df8f55e5a1cce90617fd876eaf994eb26846 /grapher/Models/Mouse | |
| parent | All works smoothly (diff) | |
| download | rawaccel-32323636b4b5390c114fc2a6d845b7621a983cdc.tar.xz rawaccel-32323636b4b5390c114fc2a6d845b7621a983cdc.zip | |
Fix initial points, add poll time constant
Diffstat (limited to 'grapher/Models/Mouse')
| -rw-r--r-- | grapher/Models/Mouse/MouseWatcher.cs | 16 | ||||
| -rw-r--r-- | grapher/Models/Mouse/PointData.cs | 11 |
2 files changed, 13 insertions, 14 deletions
diff --git a/grapher/Models/Mouse/MouseWatcher.cs b/grapher/Models/Mouse/MouseWatcher.cs index 9b1479e..fea4e2d 100644 --- a/grapher/Models/Mouse/MouseWatcher.cs +++ b/grapher/Models/Mouse/MouseWatcher.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -691,18 +692,21 @@ namespace grapher.Models.Mouse RAWINPUTDEVICE[] devices = new RAWINPUTDEVICE[1]; devices[0] = device; RegisterRawInputDevices(devices, 1, Marshal.SizeOf(typeof(RAWINPUTDEVICE))); + PollTime = 1; } - Form ContainingForm { get; } + private Form ContainingForm { get; } - Label Display { get; } + private Label Display { get; } - AccelCharts AccelCharts { get; } + private AccelCharts AccelCharts { get; } - public void OnMouseMove(int x, int y) + private double PollTime { get; } + + public void OnMouseMove(int x, int y, double timeInMs) { Display.Text = $"Last (x, y): ({x}, {y})"; - AccelCharts.MakeDots(x, y); + AccelCharts.MakeDots(x, y, timeInMs); } public void ReadMouseMove(Message message) @@ -715,7 +719,7 @@ namespace grapher.Models.Mouse if (rawInput.Data.Mouse.LastX != 0 || rawInput.Data.Mouse.LastY != 0) { - OnMouseMove(rawInput.Data.Mouse.LastX, rawInput.Data.Mouse.LastY); + OnMouseMove(rawInput.Data.Mouse.LastX, rawInput.Data.Mouse.LastY, PollTime); } } diff --git a/grapher/Models/Mouse/PointData.cs b/grapher/Models/Mouse/PointData.cs index d0273d5..12a6e73 100644 --- a/grapher/Models/Mouse/PointData.cs +++ b/grapher/Models/Mouse/PointData.cs @@ -29,18 +29,13 @@ namespace grapher.Models.Mouse } } - public (double[], double[]) Get() + public void Get(out double[] x, out double[] y) { - double[] xRet; - double[] yRet; - lock(Lock) { - xRet = X; - yRet = Y; + x = X; + y = Y; } - - return (xRet, yRet); } } } |