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.AnalogCallback")) { // This is just one of the paths: specifically, the Hydra's left // controller's analog trigger. More are in the docs and/or listed on // startup #if NET20 using (var analogTrigger = AnalogInterface.GetInterface(context, "/controller/left/trigger")) #else using (var analogTrigger = context.GetAnalogInterface("/controller/left/trigger")) #endif { analogTrigger.StateChanged += analogTrigger_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 Analog(ClientContext context, String path) { analogValue = 0.0f; analogInterface = context.GetAnalogInterface(path); analogInterface.StateChanged += AnalogInterface_StateChanged; }