Mercurial > hg > Game > Kinect
comparison main.cc @ 3:7e112b536f0a
track moving of a hand
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 01 Feb 2011 06:37:06 +0900 |
parents | 3b5465899da9 |
children |
comparison
equal
deleted
inserted
replaced
2:3b5465899da9 | 3:7e112b536f0a |
---|---|
22 } | 22 } |
23 | 23 |
24 SessionState NIState::gSessionState = NOT_IN_SESSION; | 24 SessionState NIState::gSessionState = NOT_IN_SESSION; |
25 XnBool NIState::gBDrawDepthMap = true; | 25 XnBool NIState::gBDrawDepthMap = true; |
26 void NIState::XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt) { | 26 void NIState::XN_CALLBACK_TYPE sessionStarting(const XnPoint3D &ptPosition, void *userCxt) { |
27 printf("Session start: (%f, %f, %f)\n)", ptPosition.X, ptPosition.Y, ptPosition.Z); | 27 printf("Session start: (%f, %f, %f)\n", ptPosition.X, ptPosition.Y, ptPosition.Z); |
28 gSessionState = IN_SESSION; | 28 gSessionState = IN_SESSION; |
29 } | 29 } |
30 void NIState::XN_CALLBACK_TYPE sessionEnding(void *userCxt) { | 30 void NIState::XN_CALLBACK_TYPE sessionEnding(void *userCxt) { |
31 printf("Session end\n"); | 31 printf("Session end\n"); |
32 gSessionState = NOT_IN_SESSION; | 32 gSessionState = NOT_IN_SESSION; |
33 } | 33 } |
34 void NIState::XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition, | 34 void NIState::XN_CALLBACK_TYPE focusProgress(const XnChar *strFocus, const XnPoint3D &ptPosition, |
35 XnFloat fProgress, void *userCxt) { | 35 XnFloat fProgress, void *userCxt) { |
36 //printf("Focus progress: %s @(%f, %f, %f): %f\n)", strFocus, ptPosition.X, ptPosition.Y, ptPosition.Z, fProgress); | 36 printf("Focus progress: %s @(%f, %f, %f): %f\n", strFocus, ptPosition.X, ptPosition.Y, ptPosition.Z, fProgress); |
37 } | 37 } |
38 void NIState::XN_CALLBACK_TYPE noHands(void *UserCxt) { | 38 void NIState::XN_CALLBACK_TYPE noHands(void *UserCxt) { |
39 if (gSessionState != NOT_IN_SESSION) { | 39 if (gSessionState != NOT_IN_SESSION) { |
40 printf("Quick refocus\n"); | 40 printf("Quick refocus\n"); |
41 gSessionState = QUICK_REFOCUS; | 41 gSessionState = QUICK_REFOCUS; |
73 | 73 |
74 rc = gContext.StartGeneratingAll(); | 74 rc = gContext.StartGeneratingAll(); |
75 checkRC(rc, "StartGenerating"); | 75 checkRC(rc, "StartGenerating"); |
76 | 76 |
77 while (true) { | 77 while (true) { |
78 usleep(100); | 78 gContext.WaitAndUpdateAll(); |
79 gPSessionManager->Update(&gContext); | |
80 float x, y, z; | |
81 int error = gPDrawer->getPosition(x, y, z); | |
82 if (error > 0) { | |
83 printf("%f, %f, %f\n", x, y, z); | |
84 } | |
85 | |
86 //usleep(10); | |
79 } | 87 } |
80 | 88 |
81 return 0; | 89 return 0; |
82 } | 90 } |