aboutsummaryrefslogtreecommitdiff
path: root/bindings/cs
diff options
context:
space:
mode:
authorJustin Berger <j.david.berger@gmail.com>2018-04-01 11:48:56 -0600
committerJustin Berger <j.david.berger@gmail.com>2018-04-02 00:11:42 -0600
commit7770495e7f14fe5094b31df5f5976c34fd68a0da (patch)
treeb820aa69c966a87ad09679f4e7dae2a7b717f2b6 /bindings/cs
parent0eea189db82fc72463a83a678d9b8d609fd09c6e (diff)
downloadlibsurvive-7770495e7f14fe5094b31df5f5976c34fd68a0da.tar.gz
libsurvive-7770495e7f14fe5094b31df5f5976c34fd68a0da.tar.bz2
Fixed marshalling
Diffstat (limited to 'bindings/cs')
-rw-r--r--bindings/cs/Demo/Program.cs11
-rw-r--r--bindings/cs/libsurvive.net/LibSurViveAPI.cs7
-rw-r--r--bindings/cs/libsurvive.net/cfunctions.cs2
3 files changed, 10 insertions, 10 deletions
diff --git a/bindings/cs/Demo/Program.cs b/bindings/cs/Demo/Program.cs
index aa98b6c..53c2307 100644
--- a/bindings/cs/Demo/Program.cs
+++ b/bindings/cs/Demo/Program.cs
@@ -12,13 +12,10 @@ namespace Demo
{
static void Main(string[] args)
{
- SurviveContext context = new SurviveContext(args);
- context.AddPoseUpdateCallback(HMDUpdate, -1);
-
-
- while (context.Poll() == 0) {
- }
-
+ LibSurViveAPI api = LibSurViveAPI.instance;
+
+ var so = api.GetSurviveObjectByName("HMD");
+
}
public static void HMDUpdate(int ObjectID, Vector3 pos)
diff --git a/bindings/cs/libsurvive.net/LibSurViveAPI.cs b/bindings/cs/libsurvive.net/LibSurViveAPI.cs
index 48336e8..aa2fdae 100644
--- a/bindings/cs/libsurvive.net/LibSurViveAPI.cs
+++ b/bindings/cs/libsurvive.net/LibSurViveAPI.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using libsurvive;
using System;
using System.Threading;
+using System.Runtime.InteropServices;
public class LibSurViveAPI
{
@@ -108,7 +109,7 @@ public class LibSurViveAPI
SetupConfigs configs = new SetupConfigs
{
- playbaskFile = "P:/c/libsurvive-data/lightcap-reformat/lightcap-reformat.log",
+ playbaskFile = @"C:\Users\justin\source\libsurvive-win-update\bindings\cs\Demo\lightcap-reformat.log",
configFile = "survive_conf.json",
playbackFactor = 1
};
@@ -320,8 +321,10 @@ public class SurviveObject
{
throw new Exception("Can't create SurviveObject with 0 pointer");
}
+ var ptr1 = cfunctions.Survive_object_pose(ptr);
+ pose = (SurvivePose)Marshal.PtrToStructure(ptr1, typeof(SurvivePose));
- //pose = cfunctions.Survive_object_pose(ptr);
+ //pose =
charge = cfunctions.Survive_object_charge(ptr);
charging = cfunctions.Survive_object_charging(ptr);
}
diff --git a/bindings/cs/libsurvive.net/cfunctions.cs b/bindings/cs/libsurvive.net/cfunctions.cs
index ab5f7fd..ce46d18 100644
--- a/bindings/cs/libsurvive.net/cfunctions.cs
+++ b/bindings/cs/libsurvive.net/cfunctions.cs
@@ -101,7 +101,7 @@ namespace libsurvive
public static extern bool Survive_object_charging(SurviveObjectPtr so);
[DllImport("libsurvive", CallingConvention = CallingConvention.StdCall, EntryPoint = "survive_object_pose")]
- public static extern SurvivePose Survive_object_pose(SurviveObjectPtr so);
+ public static extern IntPtr Survive_object_pose(SurviveObjectPtr so);
[DllImport("libsurvive", CallingConvention = CallingConvention.StdCall, EntryPoint = "survive_object_sensor_locations")]