LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
Example C

1#include "sr/types.h"
2
3#include "sr/core_c.h"
4#include "sr/handtrackers_c.h"
5
6#include <conio.h>
7#include <stdio.h>
8
9void listenerFunction(SR_handPose handpose) {
10 printf("%f\n", handpose.palm.x);
11}
12
13int main() {
14 SRContext context = newSRContext();
15 SR_handTracker handTracker = createHandTracker(context);
16 SR_handPoseListener handPoseListener = createHandPoseListener(handTracker, &listenerFunction);
17 initializeSRContext(context);
18 getch();
19
20 deleteHandPoseListener(handPoseListener);
21 deleteSRContext(context);
22}
void * SRContext
Definition: admin_c.h:10
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.
void * SR_handTracker
Definition: handtrackers_c.h:13
void * SR_handPoseListener
Definition: handtrackers_c.h:14
C-compatible struct containing the pose of a hand.
Definition: handpose.h:119
SR_point3d palm
Absolute position of the center of the palm.
Definition: handpose.h:127
double x
First value in the 3d vector.
Definition: types.h:76