+
+ screen = pygame.display.get_surface()
+ self.xratio = float(screen.get_size()[0]) / SCREEN_SIZE[0]
+ self.yratio = float(screen.get_size()[1]) / SCREEN_SIZE[1]
+
+ def getProjPos(self, realPos) :
+ return self.depthGene.to_projective([realPos])[0]
+
+ def setMousePosition(self, realPos) :
+ x, y, z = self.getProjPos(realPos)
+ # mirror
+ x = SCREEN_SIZE[0] - x
+ # scale
+ x, y = x * self.xratio, y * self.yratio
+ pygame.mouse.set_pos(int(x), int(y))
+
+ def handCreateCB(self, src, id, pos, time):
+ print 'Create ', id, pos
+
+ def handUpdateCB(self, src, id, pos, time):
+ self.setMousePosition(pos)
+
+ def handDestroyCB(self, src, id, time):
+ print 'Destroy ', id
+
+ def gestureRecognizedCB(self, src, gesture, id, end_point) :
+ print 'gestureDetected', src, gesture, id, end_point
+
+ def gestureProgressCB(self, src, gesture, point, progress) :
+ print 'gestureProgress', src, gesture, point, progress
+ self.handsGene.start_generating()
+ self.handsGene.start_tracking(point)
+
+ def newUserCB(self, *args, **kw) :
+ print 'newUserCB', args, kw
+
+ def lostUserCB(self, *args, **kw) :
+ print 'lostUserCB', args, kw
+