spnav-csharp-wrapper/Program.cs

41 lines
881 B
C#
Raw Normal View History

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