Пример #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;
				}
        }
    }
}
//--------------------------------------------------------------------------------------
// Update the MSAA sample count combo box for this format
//--------------------------------------------------------------------------------------
void UpdateMSAASampleCounts( ID3D10Device* pd3dDevice, DXGI_FORMAT fmt )
{
    CDXUTComboBox* pComboBox = NULL;
    bool bResetSampleCount = false;
    UINT iHighestSampleCount = 0;

    pComboBox = g_SampleUI.GetComboBox( IDC_SAMPLE_COUNT );
    if( !pComboBox )
        return;

    pComboBox->RemoveAllItems();

    WCHAR val[10];
    for( UINT i = 1; i <= D3D10_MAX_MULTISAMPLE_SAMPLE_COUNT; i++ )
    {
        UINT Quality;
        if( SUCCEEDED( pd3dDevice->CheckMultisampleQualityLevels( fmt, i, &Quality ) ) &&
            Quality > 0 )
        {
            swprintf_s( val, 10, L"%d", i );
            pComboBox->AddItem( val, IntToPtr( i ) );
            iHighestSampleCount = i;
        }
        else if( g_MSAASampleCount == i )
        {
            bResetSampleCount = true;
        }
    }

    if( bResetSampleCount )
        g_MSAASampleCount = iHighestSampleCount;

    pComboBox->SetSelectedByData( IntToPtr( g_MSAASampleCount ) );

}
Пример #3
0
void FillProfiles(BOOL DX11Available)
{
	CDXUTComboBox *comboBox = gSampleUI.GetComboBox(IDC_PROFILE);
	if (DX11Available)
	{		
        comboBox->AddItem(L"BC6H veryfast", (void *)(CompressImageBC6H_veryfast));
        comboBox->AddItem(L"BC6H fast", (void *)(CompressImageBC6H_fast));
        comboBox->AddItem(L"BC6H basic", (void *)(CompressImageBC6H_basic));
        comboBox->AddItem(L"BC6H slow", (void *)(CompressImageBC6H_slow));
        comboBox->AddItem(L"BC6H veryslow", (void *)(CompressImageBC6H_veryslow));

		comboBox->SetDropHeight((12-1)*17);
	}

	comboBox->SetSelectedByData((void *)(gCompressionFunc));
}
Пример #4
0
// Initialize the app 
void InitApp()
{
	// Initialize dialogs
	gD3DSettingsDlg.Init(&gDialogResourceManager);
	gHUD.Init(&gDialogResourceManager);
	gSampleUI.Init(&gDialogResourceManager);

	gHUD.SetCallback(OnGUIEvent);
	int x = 0;
	int y = 10;
	gHUD.AddButton(IDC_TOGGLEFULLSCREEN, L"Toggle full screen", x, y, 170, 23);
	gHUD.AddButton(IDC_TOGGLEREF, L"Toggle REF (F3)", x, y += 26, 170, 23, VK_F3);
	gHUD.AddButton(IDC_CHANGEDEVICE, L"Change device (F2)", x, y += 26, 170, 23, VK_F2);
	gHUD.SetSize( 170, 170 );
	
	gSampleUI.SetCallback(OnGUIEvent);
	x = 0;
	y = 0;
    gSampleUI.AddStatic(IDC_TEXT, L"", x, y, 1, 1); y += 5*22;
	gSampleUI.AddComboBox(IDC_PROFILE, x, y, 226, 22); y += 26;
	gSampleUI.AddCheckBox(IDC_MT, L"Multithreaded", x, y, 125, 22, gMultithreaded);
	gSampleUI.AddButton(IDC_RECOMPRESS, L"Recompress", x + 131, y, 125, 22); y += 26;
	gSampleUI.AddComboBox(IDC_IMAGEVIEW, x, y, 145, 22);
    gSampleUI.AddCheckBox(IDC_ALPHA, L"Show Alpha", x + 151, y, 105, 22); y += 26;
    gSampleUI.AddSlider(IDC_EXPOSURE, x, y, 250, 22); y += 26;
	gSampleUI.AddButton(IDC_LOAD_TEXTURE, L"Load Texture", x, y, 125, 22);
	gSampleUI.AddButton(IDC_SAVE_TEXTURE, L"Save Texture", x + 131, y, 125, 22); y += 26;

	gSampleUI.SetSize( 276, y+150 );

	{
		CDXUTComboBox *comboBox = gSampleUI.GetComboBox(IDC_IMAGEVIEW);
		comboBox->AddItem(L"Uncompressed", (void *)(eImageView_Uncompressed));
		comboBox->AddItem(L"Compressed", (void *)(eImageView_Compressed));
		//comboBox->AddItem(L"Error", (void *)(eImageView_Error));
		//comboBox->AddItem(L"All", (void *)(eImageView_All));
		comboBox->SetSelectedByData((void *)(gImageView));
	}

	gSampleUI.SendEvent(IDC_TEXT, true, gSampleUI.GetStatic(IDC_TEXT));
}