Compare commits

..

No commits in common. "master" and "unity-events" have entirely different histories.

4 changed files with 23 additions and 93 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "spacenav-driver"]
path = spacenav-driver
url = https://github.com/thib8956/spacenav-driver.git
url = https://git.digiserv.ovh/thibaud/spacenav-driver.git

View File

@ -1,3 +1,3 @@
# spnav-csharp-wrapper
Simple C# wrapper for the [HID spacenavigator driver](https://github.com/thib8956/spacenav-driver.git)
Simple C# wrapper for the HID spacenavigator [driver](https://git.digiserv.ovh/thibaud/spacenav-driver)

View File

@ -110,11 +110,7 @@ namespace SpaceNavWrapper
#region Properties
public double Sensitivity
{
get
{
return _sensitivity;
}
get => _sensitivity;
set
{
_sensitivity = value;
@ -124,34 +120,26 @@ namespace SpaceNavWrapper
public int Threshold
{
get
{
return _threshold;
}
get => _threshold;
set
{
_threshold = value;
spnav_deadzone(value);
}
}
public bool Nonblocking
{
get
{
return _nonblocking;
}
get => _nonblocking;
set
{
_nonblocking = value;
spnav_set_nonblocking(value);
_nonblocking = value;
spnav_set_nonblocking(value);
}
}
#endregion
#endregion
public void Dispose()
public void Dispose()
{
if (!isDisposed)
{

View File

@ -1,83 +1,26 @@
using System;
using System.Collections.Generic;
namespace SpaceNavWrapper
{
public enum SpaceNavAxis {
X, Y, Z, Rx, Ry, Rz
}
public class MotionEventArgs : EventArgs
{
public readonly Dictionary<SpaceNavAxis, int> axisValues;
public readonly int X, Y, Z;
public readonly int Rx, Ry, Rz;
public MotionEventArgs(int x, int y, int z, int rx, int ry, int rz)
{
axisValues = new Dictionary<SpaceNavAxis, int>();
axisValues[SpaceNavAxis.X] = x;
axisValues[SpaceNavAxis.Y] = y;
axisValues[SpaceNavAxis.Z] = y;
axisValues[SpaceNavAxis.Rx] = rx;
axisValues[SpaceNavAxis.Ry] = ry;
axisValues[SpaceNavAxis.Rz] = rz;
X = x;
Y = y;
Z = z;
Rx = rx;
Ry = ry;
Rz = rz;
}
public int X
{
get
{
return axisValues[SpaceNavAxis.X];
}
}
public int Y
{
get
{
return axisValues[SpaceNavAxis.Y];
}
}
public int Z
{
get
{
return axisValues[SpaceNavAxis.Z];
}
}
public int Rx
{
get
{
return axisValues[SpaceNavAxis.Rx];
}
}
public int Ry
{
get
{
return axisValues[SpaceNavAxis.Ry];
}
}
public int Rz
{
get
{
return axisValues[SpaceNavAxis.Rz];
}
}
public override string ToString()
{
return string.Format("x={0} y={1} z={2} rx={3} ry={4} rz={5}", X, Y, Z, Rx, Ry, Rz);
}
public int GetAxis(SpaceNavAxis axis)
{
return axisValues[axis];
return "x=" + X + " y=" + Y + " z=" + Z +
" rx=" + Rz + " ry=" + Ry + " rz=" + Rz;
}
}
@ -91,10 +34,9 @@ namespace SpaceNavWrapper
Pressed = pressed;
Button = button;
}
public override string ToString()
{
return string.Format("button={0}, pressed={1}", Button, Pressed);
return string.Format("[ButtonEventArgs: button={0}, pressed={1}]", Button, Pressed);
}
}
}