Esempio n. 1
0
//--------------------------------------------------------------------------------------
// Handle messages to the application
//--------------------------------------------------------------------------------------
LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, bool* pbNoFurtherProcessing,
                          void* pUserContext )
{
  UNREFERENCED_PARAMETER(pUserContext);

  // Pass messages to dialog resource manager calls so GUI state is updated correctly
  *pbNoFurtherProcessing = g_DialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam );
  if( *pbNoFurtherProcessing )
      return 0;
  
  // Pass messages to settings dialog if its active
  if( g_D3DSettingsDlg.IsActive() )
  {
      g_D3DSettingsDlg.MsgProc( hWnd, uMsg, wParam, lParam );
      return 0;
  }
  
  // Give the dialogs a chance to handle the message first
  *pbNoFurtherProcessing = g_HUD.MsgProc( hWnd, uMsg, wParam, lParam );
  if( *pbNoFurtherProcessing )
      return 0;
  *pbNoFurtherProcessing = g_SampleUI.MsgProc( hWnd, uMsg, wParam, lParam );
  if( *pbNoFurtherProcessing )
      return 0;
  
  // Pass all remaining windows messages to camera so it can respond to user input
  g_ViewerCamera.HandleMessages( hWnd, uMsg, wParam, lParam );
  
  return 0;
}
Esempio n. 2
0
//--------------------------------------------------------------------------------------
// Handle messages to the application 
//--------------------------------------------------------------------------------------
LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, 
                          bool* pbNoFurtherProcessing, void* pUserContext )
{
    // Pass all remaining windows messages to camera so it can respond to user input
    g_Camera.HandleMessages( hWnd, uMsg, wParam, lParam );

    switch( uMsg )
    {
        case WM_LBUTTONDOWN:
        case WM_LBUTTONDBLCLK:
            g_bLeftMouseDown = true;
            break;
        case WM_LBUTTONUP:
            g_bLeftMouseDown = false;
            break;
        case WM_CAPTURECHANGED:
            if( (HWND)lParam != hWnd )
                g_bLeftMouseDown = false;
            break;
    }

    return MyAppMsgProc(hWnd, uMsg, wParam, lParam, 
                          pbNoFurtherProcessing, pUserContext);
}
//--------------------------------------------------------------------------------------
// Handle messages to the application
//--------------------------------------------------------------------------------------
LRESULT CALLBACK MsgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, 
                          bool* pbNoFurtherProcessing, void* pUserContext)
{
    // Always allow dialog resource manager calls to handle global messages
    // so GUI state is updated correctly
    *pbNoFurtherProcessing = g_DialogResourceManager.MsgProc(hWnd, uMsg, wParam, lParam);
    if (*pbNoFurtherProcessing)
    {
        return 0;
    }

    if (g_SettingsDlg.IsActive())
    {
        g_SettingsDlg.MsgProc(hWnd, uMsg, wParam, lParam);
        return 0;
    }

    // Give the dialogs a chance to handle the message first
    *pbNoFurtherProcessing = g_HUD.MsgProc(hWnd, uMsg, wParam, lParam);
    if (*pbNoFurtherProcessing)
    {
        return 0;
    }

    // Pass all windows messages to camera so it can respond to user input
    if (g_UseOrbitalCamera)
    {
        g_OrbitalCamera.HandleMessages(hWnd, uMsg, wParam, lParam);
    }
    else
    {
        g_FirstPersonCamera.HandleMessages(hWnd, uMsg, wParam, lParam);
    }

    return 0;
}