XBMCMove 1.0
Controlar o XBMC com gestos
|
00001 00005 #define SAMPLE_XML_FILE "./config/Sample-Tracking.xml" 00007 //DEFINES para MSG 00008 #define CONECTADO 0 00009 #define FALHOU 1 00010 #define CLOSE 2 00011 #define RESUME 10 // Na versão nova não existe mais! 00012 #define PLAY 11 00013 #define PAUSE 12 00014 #define STOP 13 00015 #define END 14 // Na versão nova não existe mais! 00016 00017 //DIFINES para TIPO 00018 #define MENU 0 00019 #define FILME 1 00020 #define MUSICA 2 00021 #define SPEED 3 00022 00023 #include <stdio.h> 00024 #include <XnCppWrapper.h> 00025 #include <XnOpenNI.h> 00026 #include <XnCodecIDs.h> 00027 #include <XnVHandPointContext.h> 00028 #include <XnVSessionManager.h> 00029 #include <XnVCircleDetector.h> 00030 #include <XnVWaveDetector.h> 00031 #include <XnVSwipeDetector.h> 00032 #include <XnVGesture.h> 00033 #include <XnVSelectableSlider2D.h> 00034 using namespace xn; 00035 00036 #include "teclado.h" 00037 #include "Thread.h" 00038 XnStatus rc; // Para verificar erros 00039 teclado * teclar = new teclado(); 00040 xn::Context g_Context; //Contexto 00041 xn::Context g_Context2; //Contexto 00042 xn::ScriptNode g_ScriptNode; //Script de configuração Nós 00043 XnVSessionManager * g_pSessionManager = (XnVSessionManager *) malloc(sizeof (XnVSessionManager)); //Gerenciador de Seção 00044 XnVCircleDetector* g_pCircle = (XnVCircleDetector *) malloc(sizeof (XnVCircleDetector)); //Detector de circulo 00045 XnVSwipeDetector* g_pSwipeD = (XnVSwipeDetector *) malloc(sizeof (XnVSwipeDetector)); //Detector de Swipe (Gestos UP,DOWN,LEFT,RIGHT) 00046 xn::GestureGenerator g_GestureGenerator; 00047 xn::HandsGenerator g_HandsGenerator; 00048 XnVSelectableSlider2D* g_pTrackPad = (XnVSelectableSlider2D *) malloc(sizeof (XnVSelectableSlider2D)); 00049 xn::EnumerationErrors errors; 00050 XnVWaveDetector *wc = (XnVWaveDetector *) malloc(sizeof (XnVWaveDetector)); 00051 00052 xn::DepthGenerator g_DepthGenerator; 00053 xn::UserGenerator g_UserGenerator; 00054 xn::Player g_Player; 00055 00056 XnBool g_bNeedPose = FALSE; 00057 XnChar g_strPose[20] = ""; 00058 XnUserID userIds[5] = {0}; 00059 XnUInt16 nUsers = 5; 00060 bool gestoTrack = true; 00061 int id = 0; 00062 float conf = 0; // joint confidence 00063 float rh[3]; // right hand coordinates (x[px], y[px], z[meters]) 00064 float lh[3]; // left hand coordinates 00065 float t[3]; // torso coordinates 00066 float head[3]; // Cabeça 00067 //float ombroD[3]; //Ombro Direito 00068 //float ombroE[3]; // Ombro Esquerdo 00069 //float cotoveloE[3]; //Cotovelo Esquerdo 00070 //float cotoveloD[3]; //Cotovelo Direito 00071 00072 float posInit[2]; 00073 float distInit = 0; 00074 int volumeCont = 0; 00075 int fecharCont = 0; 00076 00077 bool rodando = false; 00078 00079 XnCallbackHandle h1, h2; 00080 00081 float circuloDirecaoAntiga = 0; //Variavel para identificação da direção do circulo 00082 float circuloDirecaoAtual = 0; //Variavel para identificação da direção do circulo 00083 bool xbmc = false; 00084 int msg = 99; 00085 int amsg = 100; 00086 int tipo = 99; 00087 bool gFechar = false; 00088 bool gVolume = false; 00089 bool gCirculo = false; 00090 pthread_t threadC; //Thread para circulo 00091 long tC; 00092 pthread_t threadG; //Thread para Swipes,trackpad 00093 long tG; 00094 00095 XnUInt32 g_TP_XDim = 4; 00096 XnUInt32 g_TP_YDim = 9; 00097 00098 XnCallbackHandle g_nItemHoverHandle = NULL; 00099 XnCallbackHandle g_nItemSelectHandle = NULL; 00100 XnCallbackHandle g_nValueChangeHandle = NULL; 00101 00102 XnCallbackHandle g_nPrimaryCreateHandle = NULL; 00103 XnCallbackHandle g_nPrimaryDestroyHandle = NULL; 00104 00105 XnUInt32 g_TrackPadHandle = 0; 00106 00107 XnBool g_isPrintItemHover = TRUE; 00108 XnBool g_isPrintValueChange = FALSE; 00109 XnBool g_isInputStarted = FALSE; 00110 00111 XnVector3D projective; 00112 XnSkeletonJointPosition skeletonJointPosition; 00113