From cf4c2c50e75e6b21d7aa65211031417619e4dacd Mon Sep 17 00:00:00 2001 From: dpeter99 Date: Fri, 30 Mar 2018 20:54:08 +0200 Subject: Some tests --- bindings/cs/Demo/Program.cs | 46 +++++++++------------------------------------ 1 file changed, 9 insertions(+), 37 deletions(-) (limited to 'bindings/cs/Demo') diff --git a/bindings/cs/Demo/Program.cs b/bindings/cs/Demo/Program.cs index c03d83c..aa98b6c 100644 --- a/bindings/cs/Demo/Program.cs +++ b/bindings/cs/Demo/Program.cs @@ -7,50 +7,22 @@ using System.Threading.Tasks; namespace Demo { - internal class MyHandler : SurviveContext + + class Program { - private static void WritePose(string name, SurvivePose pose) + static void Main(string[] args) { - Console.Out.WriteLine(name); - Console.Out.Write(" [ "); - for (int i = 0; i < 3; i++) - Console.Out.Write("{0} ", pose.Pos[i]); - Console.Out.Write(" ] [ "); - for (int i = 0; i < 4; i++) - Console.Out.Write("{0} ", pose.Rot[i]); - Console.Out.Write(" ] "); - Console.Out.WriteLine(); - } + SurviveContext context = new SurviveContext(args); + context.AddPoseUpdateCallback(HMDUpdate, -1); - public MyHandler() : base() - { - } - public MyHandler(string[] args) : base(args) - { - } + while (context.Poll() == 0) { + } - protected void LightHouseEvent1(IntPtr ctx, byte lighthouse, SurvivePose lighthouse_pose, SurvivePose object_pose) - { - base.LightHouseEvent(ctx, lighthouse, lighthouse_pose, object_pose); - WritePose("Lighthouse", lighthouse_pose); - WritePose("Object", object_pose); } - - protected override void PoseEvent(IntPtr so, byte lighthouse, SurvivePose pose) - { - WritePose("Pose", pose); - base.PoseEvent(so, lighthouse, pose); - } - } - class Program - { - static void Main(string[] args) + + public static void HMDUpdate(int ObjectID, Vector3 pos) { - MyHandler handler = new MyHandler(args); - - while (handler.Poll() == 0) { - } } -- cgit v1.2.3