2018-05-30 21:12:00 +00:00
|
|
|
|
using System;
|
2018-05-30 17:36:06 +00:00
|
|
|
|
|
2018-05-30 21:12:00 +00:00
|
|
|
|
namespace SpaceNavWrapper
|
2018-05-30 17:15:37 +00:00
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
2018-05-30 21:12:00 +00:00
|
|
|
|
//spnavwrapper.SpaceNav.Instance.Threshold = 5;
|
|
|
|
|
//spnavwrapper.SpaceNav.Instance.Sensitivity = 0.1;
|
|
|
|
|
|
|
|
|
|
//for (; ; )
|
|
|
|
|
//{
|
|
|
|
|
// var ev = spnavwrapper.SpaceNav.Instance.WaitEvent(100);
|
|
|
|
|
// Console.WriteLine(ev);
|
|
|
|
|
//}
|
2018-05-30 21:53:56 +00:00
|
|
|
|
SpaceNav navDriver = new SpaceNav();
|
2018-05-30 21:12:00 +00:00
|
|
|
|
navDriver.InitDevice();
|
|
|
|
|
navDriver.Button += OnButton;
|
|
|
|
|
navDriver.Motion += OnMotion;
|
|
|
|
|
|
|
|
|
|
Console.CancelKeyPress += delegate {
|
|
|
|
|
navDriver.Dispose();
|
|
|
|
|
};
|
2018-05-30 21:53:56 +00:00
|
|
|
|
for (; ; )
|
|
|
|
|
{
|
|
|
|
|
navDriver.WaitEvent();
|
|
|
|
|
}
|
2018-05-30 17:15:37 +00:00
|
|
|
|
}
|
2018-05-30 21:12:00 +00:00
|
|
|
|
|
|
|
|
|
private static void OnMotion(object sender, MotionEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void OnButton(object sender, EventArgs e)
|
|
|
|
|
{
|
2018-05-30 21:53:56 +00:00
|
|
|
|
Console.WriteLine(e);
|
2018-05-30 21:12:00 +00:00
|
|
|
|
}
|
2018-05-30 17:15:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|