基于Dragonboard 410c的kinect应用系列之四——获取人体骨骼图
时间:02-21
来源:互联网
点击:
MessageRouter,
reinterpret_cast<LPARAM>(this));
// Show window
ShowWindow(hWndApp, nCmdShow);
const int eventCount = 1;
HANDLE hEvents[eventCount];
="line" id="LC110"> // Main message loop
="line" id="LC111"> while (WM_QUIT != msg.message) ="line" id="LC112"> { ="line" id="LC113"> hEvents[0] = m_hNextSkeletonEvent; ="line" id="LC114"> ="line" id="LC115"> // Check to see if we have either a message (by passing in QS_ALLEVENTS) ="line" id="LC116"> // Or a Kinect event (hEvents) ="line" id="LC117"> // Update() will check for Kinect events individually, in case more than one are signalled ="line" id="LC118"> MsgWaitForMultipleObjects(eventCount, hEvents, FALSE, INFINITE, QS_ALLINPUT); ="line" id="LC119"> ="line" id="LC120"> // Explicitly check the Kinect frame event since MsgWaitForMultipleObjects ="line" id="LC121"> // can return for other reasons even though it is signaled. ="line" id="LC122"> Update(); ="line" id="LC123"> ="line" id="LC124"> while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) ="line" id="LC125"> { ="line" id="LC126"> // If a dialog message will be taken care of by the dialog proc ="line" id="LC127"> if ((hWndApp != NULL) && IsDialogMessageW(hWndApp, &msg)) ="line" id="LC128"> { ="line" id="LC129"> continue; ="line" id="LC130"> } ="line" id="LC131"> ="line" id="LC132"> TranslateMessage(&msg); ="line" id="LC133"> DispatchMessageW(&msg); ="line" id="LC134"> } ="line" id="LC135"> } ="line" id="LC136"> ="line" id="LC137"> return static_cast<int>(msg.wParam); ="line" id="LC138"> } ="line" id="LC139"> ="line" id="LC140"> /// <summary> ="line" id="LC141"> /// Main processing function ="line" id="LC142"> /// </summary> ="line" id="LC143"> void CSkeletonBasics::Update() ="line" id="LC144"> { ="line"> ="line" id="LC145"> if (NULL == m_pNuiSensor) ="line" id="LC146"> { ="line" id="LC147"> return; ="line" id="LC148"> } ="line" id="LC149"> ="line" id="LC150"> // Wait for 0ms, just quickly test if it is time to process a skeleton ="line" id="LC151"> if ( WAIT_OBJECT_0 == WaitForSingleObject(m_hNextSkeletonEvent, 0) ) ="line" id="LC152"> { ="line" id="LC153"> ProcessSkeleton(); ="line" id="LC154"> } ="line" id="LC155"> } ="line" id="LC156"> ="line" id="LC157"> /// <summary> ="line" id="LC158"> /// Handles window messages, passes most to the class instance to handle ="line" id="LC159"> /// </summary> ="line" id="LC160"> /// <param name="hWnd">window message is for</param> ="line" id="LC161"> /// <param name="uMsg">message</param> ="line" id="LC162"> /// <param name="wParam">message data</param> ="line" id="LC163"> /// <param name="lParam">additional message data</param> ="line" id="LC164"> /// <returns>result of message processing</returns> ="line" id="LC165"> LRESULT CALLBACK CSkeletonBasics::MessageRouter(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ="line" id="LC166"> { ="line" id="LC167"> CSkeletonBasics* pThis = NULL; ="line" id="LC168"> ="line" id="LC169"> if (WM_INITDIALOG == uMsg) ="line" id="LC170"> { ="line" id="LC171"> pThis = reinterpret_casDragonBoard 410c Kinect 相关文章: