2018-05-30 21:12:00 +00:00
|
|
|
|
using System;
|
2018-05-31 09:56:21 +00:00
|
|
|
|
using System.Collections.Generic;
|
2018-05-30 17:15:37 +00:00
|
|
|
|
|
2018-05-30 21:12:00 +00:00
|
|
|
|
namespace SpaceNavWrapper
|
|
|
|
|
{
|
2018-05-31 09:56:21 +00:00
|
|
|
|
public enum SpaceNavAxis {
|
|
|
|
|
X, Y, Z, Rx, Ry, Rz
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 21:12:00 +00:00
|
|
|
|
public class MotionEventArgs : EventArgs
|
2018-05-30 17:15:37 +00:00
|
|
|
|
{
|
2018-05-31 09:56:21 +00:00
|
|
|
|
public readonly Dictionary<SpaceNavAxis, int> axisValues;
|
|
|
|
|
|
2018-05-30 21:12:00 +00:00
|
|
|
|
public MotionEventArgs(int x, int y, int z, int rx, int ry, int rz)
|
|
|
|
|
{
|
2018-05-31 09:56:21 +00:00
|
|
|
|
axisValues = new Dictionary<SpaceNavAxis, int>
|
|
|
|
|
{
|
|
|
|
|
[SpaceNavAxis.X] = x,
|
|
|
|
|
[SpaceNavAxis.Y] = y,
|
|
|
|
|
[SpaceNavAxis.Z] = y,
|
|
|
|
|
[SpaceNavAxis.Rx] = rx,
|
|
|
|
|
[SpaceNavAxis.Ry] = ry,
|
|
|
|
|
[SpaceNavAxis.Rz] = rz
|
|
|
|
|
};
|
2018-05-30 21:12:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 09:56:21 +00:00
|
|
|
|
public int X => axisValues[SpaceNavAxis.X];
|
|
|
|
|
public int Y => axisValues[SpaceNavAxis.Y];
|
|
|
|
|
public int Z => axisValues[SpaceNavAxis.Z];
|
|
|
|
|
public int Rx => axisValues[SpaceNavAxis.Rx];
|
|
|
|
|
public int Ry => axisValues[SpaceNavAxis.Ry];
|
|
|
|
|
public int Rz => axisValues[SpaceNavAxis.Rz];
|
|
|
|
|
|
2018-05-30 17:15:37 +00:00
|
|
|
|
public override string ToString()
|
2018-05-31 09:56:21 +00:00
|
|
|
|
{
|
|
|
|
|
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)
|
2018-05-30 17:15:37 +00:00
|
|
|
|
{
|
2018-05-31 09:56:21 +00:00
|
|
|
|
return axisValues[axis];
|
2018-05-30 17:15:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-30 21:12:00 +00:00
|
|
|
|
public class ButtonEventArgs : EventArgs
|
2018-05-30 21:53:56 +00:00
|
|
|
|
{
|
|
|
|
|
public readonly bool Pressed;
|
|
|
|
|
public readonly int Button;
|
2018-05-30 21:12:00 +00:00
|
|
|
|
|
2018-05-30 21:53:56 +00:00
|
|
|
|
public ButtonEventArgs(bool pressed, int button)
|
2018-05-30 21:12:00 +00:00
|
|
|
|
{
|
2018-05-30 21:53:56 +00:00
|
|
|
|
Pressed = pressed;
|
|
|
|
|
Button = button;
|
2018-05-30 21:12:00 +00:00
|
|
|
|
}
|
2018-05-31 09:56:21 +00:00
|
|
|
|
|
2018-05-30 21:53:56 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2018-05-31 09:56:21 +00:00
|
|
|
|
return string.Format("button={0}, pressed={1}", Button, Pressed);
|
2018-05-30 21:53:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-30 17:15:37 +00:00
|
|
|
|
}
|