基于Dragonboard 410c的kinect应用系列之四——获取人体骨骼图
时间:02-21
来源:互联网
点击:
="line" id="LC171">
pThis = reinterpret_cast<CSkeletonBasics*>(lParam);
="line" id="LC172">
SetWindowLongPtr(hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(pThis));
="line" id="LC173">
}
="line" id="LC174">
else
="line" id="LC175">
{
="line" id="LC176">
pThis = reinterpret_cast<CSkeletonBasics*>(::GetWindowLongPtr(hWnd, GWLP_USERDATA));
="line" id="LC177">
}
="line" id="LC178">
="line" id="LC179">
if (pThis)
="line" id="LC180">
{
="line" id="LC181">
return pThis->DlgProc(hWnd, uMsg, wParam, lParam);
="line" id="LC182">
}
="line" id="LC183">
="line" id="LC184">
return 0;
="line" id="LC185">
}
="line">
="line" id="LC187">
/// <summary>
="line" id="LC188">
/// Handle windows messages for the class instance
="line" id="LC189">
/// </summary>
="line" id="LC190">
/// <param name="hWnd">window message is for</param>
="line" id="LC191">
/// <param name="uMsg">message</param>
="line" id="LC192">
/// <param name="wParam">message data</param>
="line" id="LC193">
/// <param name="lParam">additional message data</param>
="line" id="LC194">
/// <returns>result of message processing</returns>
="line" id="LC195">
LRESULT CALLBACK CSkeletonBasics::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
="line" id="LC196">
{
="line" id="LC197">
switch (message)
="line" id="LC198">
{
="line" id="LC199">
case WM_INITDIALOG:
="line" id="LC200">
{
="line" id="LC201">
// Bind application window handle
="line" id="LC202">
m_hWnd = hWnd;
="line" id="LC203">
="line" id="LC204">
// Init Direct2D
="line" id="LC205">
D2D1CreateFactory(D2D1_FACTORY_TYPE_SINGLE_THREADED, &m_pD2DFactory);
="line" id="LC206">
="line" id="LC207">
// Look for a connected Kinect, and create it if found
="line" id="LC208">
CreateFirstConnected();
="line" id="LC209">
}
="line" id="LC210">
break;
="line" id="LC211">
="line" id="LC212">
// If the titlebar X is clicked, destroy app
="line" id="LC213">
case WM_CLOSE:
="line" id="LC214">
DestroyWindow(hWnd);
="line" id="LC215">
break;
="line" id="LC216">
="line" id="LC217">
case WM_DESTROY:
="line" id="LC218">
// Quit the main message pump
="line" id="LC219">
PostQuitMessage(0);
="line" id="LC220">
break;
="line" id="LC221">
="line" id="LC222">
// Handle button press
="line" id="LC223">
case WM_COMMAND:
="line" id="LC224">
// If it was for the near mode control and a clicked event, change near mode
="line" id="LC225">
if (IDC_CHECK_SEATED == LOWORD(wParam) && BN_CLICKED == HIWORD(wParam))
="line" id="LC226">
{
="line" id="LC227">
// Toggle out internal state for near mode
="line" id="LC228">
m_bSeatedMode = !m_bSeatedMode;
="line">
="line">
="line" id="LC230">
if (NULL != m_pNuiSensor)
="line" id="LC231">
{
="line" id="LC232">
// Set near mode for sensor based on our internal state
="line" id="LC233">
m_pNuiSensor->NuiSkeletonTrackingEnable(m_hNextSkeletonEvent, m_bSeatedMode ? NUI_SKELETON_TRACKING_FLAG_ENABLE_SEATED_SUPPORT : 0);
="line" id="LC234">
}
DragonBoard 410c Kinect 相关文章: