From 4fc4476108f0ad49a4dce99ff2506c3da9b3994a Mon Sep 17 00:00:00 2001 From: dpeter99 Date: Sun, 1 Apr 2018 21:28:19 +0200 Subject: Fixed the parameters --- bindings/cs/libsurvive.net/LibSurViveAPI.cs | 40 +++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'bindings') diff --git a/bindings/cs/libsurvive.net/LibSurViveAPI.cs b/bindings/cs/libsurvive.net/LibSurViveAPI.cs index aa2fdae..922a055 100644 --- a/bindings/cs/libsurvive.net/LibSurViveAPI.cs +++ b/bindings/cs/libsurvive.net/LibSurViveAPI.cs @@ -309,24 +309,42 @@ public class LibSurViveAPI public class SurviveObject { - public SurvivePose pose { get; private set; } + private SurvivePose _pose; + public SurvivePose Pose + { + get + { + var ptr1 = cfunctions.Survive_object_pose(ptr); + return (SurvivePose)Marshal.PtrToStructure(ptr1, typeof(SurvivePose)); + } + } - public int charge { get; private set; } - public bool charging { get; private set; } + private int _charge; + public int Charge + { + get + { + return cfunctions.Survive_object_charge(ptr); + } + } + public bool Charging + { + get + { + return cfunctions.Survive_object_charging(ptr); + } + } + IntPtr ptr; + private bool _charging; - public SurviveObject(IntPtr ptr) + public SurviveObject(IntPtr obj_ptr) { - if (ptr == IntPtr.Zero) + if (obj_ptr == IntPtr.Zero) { 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 = - charge = cfunctions.Survive_object_charge(ptr); - charging = cfunctions.Survive_object_charging(ptr); + ptr = obj_ptr; } } -- cgit v1.2.3