Esempio n. 1
0
// Handle key presses
void CALLBACK OnKeyboard( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext )
{
    if( bKeyDown )
    {
        switch( nChar )
        {
            case VK_F1:
                gShowHelp = !gShowHelp; break;
			case VK_TAB:
				{
					CDXUTComboBox *comboBox = gSampleUI.GetComboBox(IDC_IMAGEVIEW);
					if (eImageView_Uncompressed == (intptr_t)comboBox->GetSelectedData())
					{
						comboBox->SetSelectedByData((void*)eImageView_Compressed);
					} 
					else if (eImageView_Compressed == (intptr_t)comboBox->GetSelectedData())
					{
						comboBox->SetSelectedByData((void*)eImageView_Uncompressed);
					}
					gSampleUI.SendEvent(IDC_IMAGEVIEW, true, comboBox);
					break;
				}
        }
    }
}
//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{
	CDXUTComboBox* pComboBox = NULL;
	CDXUTComboBox* pAABBLevelComboBox = NULL;
    switch( nControlID )
    {
    case IDC_TOGGLEFULLSCREEN:
        DXUTToggleFullScreen(); break;
    case IDC_TOGGLEWARP:
        DXUTToggleWARP(); break;
    case IDC_TOGGLEREF:
        DXUTToggleREF(); break;
    case IDC_CHANGEDEVICE:
        g_SettingsDlg.SetActive( !g_SettingsDlg.IsActive() ); break;  
	case IDC_SCENERASTERIZER_MODE:
		    //CDXUTComboBox* pComboBox = NULL;
            pComboBox = ( CDXUTComboBox* )pControl;
            g_eSceneRasterizerMode = ( UINT )PtrToInt( pComboBox->GetSelectedData() );
            break;
	case IDC_AABBSUBLEVEL:
        pAABBLevelComboBox = ( CDXUTComboBox* )pControl;
        g_CurrentAABBLevel = ( UINT )PtrToInt( pAABBLevelComboBox->GetSelectedData() );
        break;
    }
}
//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{
    switch( nControlID )
    {
        case IDC_TOGGLEFULLSCREEN:
            DXUTToggleFullScreen(); break;
        case IDC_TOGGLEREF:
            DXUTToggleREF(); break;
        case IDC_CHANGEDEVICE:
            g_D3DSettingsDlg.SetActive( !g_D3DSettingsDlg.IsActive() ); break;
        case IDC_TOGGLEWARP:
            DXUTToggleWARP(); break;
        case IDC_TOGGLE_BLUR:
            g_bUseMotionBlur = !g_bUseMotionBlur;
            break;
        case IDC_RENDER_OGRE:
            g_bRenderOgre = !g_bRenderOgre;
            break;
        case IDC_SAMPLE_COUNT:
        {
            CDXUTComboBox* pComboBox = ( CDXUTComboBox* )pControl;

            g_MSAASampleCount = ( UINT )PtrToInt( pComboBox->GetSelectedData() );

            HRESULT hr = S_OK;
            ID3D10Device* pd3dDevice = DXUTGetD3D10Device();
            if( pd3dDevice )
                V( CreateRenderTarget( pd3dDevice, g_BackBufferWidth, g_BackBufferHeight, g_MSAASampleCount, 0 ) );
        }
            break;
    }
}