2using System.Runtime.InteropServices;
4namespace SimulatedReality
6 [StructLayout(LayoutKind.Sequential)]
13 [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3*21)]
14 public double[] joints;
17 public static class SR
19 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
20 public delegate
void acceptHandPoseCallback(
SR_handPose handPose);
23 [DllImport(
"SimulatedRealityCore.dll")]
25 [DllImport(
"SimulatedRealityCore.dll")]
27 [DllImport(
"SimulatedRealityCore.dll")]
29 [DllImport(
"SimulatedRealityHandTrackers.dll")]
31 [DllImport(
"SimulatedRealityHandTrackers.dll")]
33 [DllImport(
"SimulatedRealityHandTrackers.dll")]
36 [DllImport(
"SimulatedRealityCore32.dll")]
38 [DllImport(
"SimulatedRealityCore32.dll")]
40 [DllImport(
"SimulatedRealityCore32.dll")]
42 [DllImport(
"SimulatedRealityHandTrackers32.dll")]
44 [DllImport(
"SimulatedRealityHandTrackers32.dll")]
46 [DllImport(
"SimulatedRealityHandTrackers32.dll")]
SRAPI void deleteHandPoseListener(SR_handPoseListener handPoseListener)
Cleans up underlying object instances used to facilitate hand pose update callbacks.
SRAPI SR_handPoseListener createHandPoseListener(SR_handTracker handTracker, void(*acceptHandPoseCallback)(SR_handPose))
Create a new callback function to listen to a specific handtracker.
SRAPI SR_handTracker createHandTracker(SRContext context)
Creates a functional HandTracker instance.
SRAPI void deleteSRContext(SRContext context)
Delete and clean up the instance of SRContext.
SRAPI SRContext newSRContext()
Construct an instance of SRContext, the environment in which created senses are kept track of.
SRAPI void initializeSRContext(SRContext context)
Initialize all senses.
Namespace containing all C++ Simulated Reality classes.
Definition: srconfiguration.h:20
C-compatible struct containing the pose of a hand.
Definition: handpose.h:119
8 static void Main(
string[] args)
10 SR.acceptHandPoseCallback acceptHandPose = (
SR_handPose handPose) =>
12 Console.WriteLine(handPose.joints[0]);
15 var context =
SR.newSRContext();
16 var handTracker =
SR.createHandTracker(context);
17 var handPoseListener =
SR.createHandPoseListener(handTracker, acceptHandPose);
18 SR.initializeSRContext(context);
22 SR.deleteHandPoseListener(handPoseListener);
23 SR.deleteSRContext(context);