static void Main(string[] args) { ClientContext.PreloadNativeLibraries(); using (ServerAutoStarter serverAutoStarter = new ServerAutoStarter()) using (OSVR.ClientKit.ClientContext context = new OSVR.ClientKit.ClientContext("com.osvr.exampleclients.managed.Locomotion")) { #if NET20 using (var naviPosition = NaviPositionInterface.GetInterface(context, "/me/feet/both")) using (var naviVelocity = NaviVelocityInterface.GetInterface(context, "/me/feet/both")) #else using (var naviPosition = context.GetNaviPositionInterface("/me/feet/both")) using (var naviVelocity = context.GetNaviVelocityInterface("/me/feet/both")) #endif { naviPosition.StateChanged += locomotionPosition_StateChanged; naviVelocity.StateChanged += locomotionVelocity_StateChanged; // Pretend that this is your application's main loop for (int i = 0; i < 1000000; ++i) { context.update(); } Console.WriteLine("Library shut down; exiting."); } } }
public Locomotion(ClientContext context, String path) { positionInterface = context.GetNaviPositionInterface(path); velocityInterface = context.GetNaviVelocityInterface(path); positionInterface.StateChanged += PositionInterface_StateChanged; velocityInterface.StateChanged += VelocityInterface_StateChanged; }