aboutsummaryrefslogtreecommitdiff
path: root/bindings/cs/Demo/Program.cs
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-04-02 10:10:33 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-04-02 10:10:33 -0600
commit75460f240c9d003e4ca2e6dda9b2146a74df7ffa (patch)
tree957b26f0539df176b61ad2ec72fbb0658b147919 /bindings/cs/Demo/Program.cs
parent2b63278497130d01b1fbc7e6a94b6ad8e32ab4dd (diff)
parent1724abef15a4090640bd82ba408681438316de7e (diff)
downloadlibsurvive-75460f240c9d003e4ca2e6dda9b2146a74df7ffa.tar.gz
libsurvive-75460f240c9d003e4ca2e6dda9b2146a74df7ffa.tar.bz2
Merge remote-tracking branch 'origin/master' into imu
Diffstat (limited to 'bindings/cs/Demo/Program.cs')
-rw-r--r--bindings/cs/Demo/Program.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/bindings/cs/Demo/Program.cs b/bindings/cs/Demo/Program.cs
new file mode 100644
index 0000000..c03d83c
--- /dev/null
+++ b/bindings/cs/Demo/Program.cs
@@ -0,0 +1,58 @@
+using libsurvive;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Demo
+{
+ internal class MyHandler : SurviveContext
+ {
+ private static void WritePose(string name, SurvivePose pose)
+ {
+ 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();
+ }
+
+ public MyHandler() : base()
+ {
+ }
+
+ public MyHandler(string[] args) : base(args)
+ {
+ }
+
+ 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)
+ {
+ MyHandler handler = new MyHandler(args);
+
+ while (handler.Poll() == 0) {
+ }
+
+ }
+
+ }
+}