Update events with GetAxis
This commit is contained in:
parent
6b16cee62b
commit
7bf9f39301
@ -1,26 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SpaceNavWrapper
|
||||
{
|
||||
public enum SpaceNavAxis {
|
||||
X, Y, Z, Rx, Ry, Rz
|
||||
}
|
||||
|
||||
public class MotionEventArgs : EventArgs
|
||||
{
|
||||
public readonly int X, Y, Z;
|
||||
public readonly int Rx, Ry, Rz;
|
||||
|
||||
public readonly Dictionary<SpaceNavAxis, int> axisValues;
|
||||
|
||||
public MotionEventArgs(int x, int y, int z, int rx, int ry, int rz)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Z = z;
|
||||
Rx = rx;
|
||||
Ry = ry;
|
||||
Rz = rz;
|
||||
axisValues = new Dictionary<SpaceNavAxis, int>
|
||||
{
|
||||
[SpaceNavAxis.X] = x,
|
||||
[SpaceNavAxis.Y] = y,
|
||||
[SpaceNavAxis.Z] = y,
|
||||
[SpaceNavAxis.Rx] = rx,
|
||||
[SpaceNavAxis.Ry] = ry,
|
||||
[SpaceNavAxis.Rz] = rz
|
||||
};
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
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 "x=" + X + " y=" + Y + " z=" + Z +
|
||||
" rx=" + Rz + " ry=" + Ry + " rz=" + Rz;
|
||||
return axisValues[axis];
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,9 +52,10 @@ namespace SpaceNavWrapper
|
||||
Pressed = pressed;
|
||||
Button = button;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("[ButtonEventArgs: button={0}, pressed={1}]", Button, Pressed);
|
||||
return string.Format("button={0}, pressed={1}", Button, Pressed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user