本文整理汇总了C++中CDXUTComboBox::AddItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTComboBox::AddItem方法的具体用法?C++ CDXUTComboBox::AddItem怎么用?C++ CDXUTComboBox::AddItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTComboBox
的用法示例。
在下文中一共展示了CDXUTComboBox::AddItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: REF
//--------------------------------------------------------------------------------------
// Create any D3D9 resources that will live through a device reset (D3DPOOL_MANAGED)
// and aren't tied to the back buffer size
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D9CreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_DialogResourceManager.OnD3D9CreateDevice( pd3dDevice );
g_SettingsDlg.OnD3D9CreateDevice( pd3dDevice );
g_HUD.SetCallback( OnGUIEvent );
int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent );
iY = 10;
g_SampleUI.AddCheckBox( IDC_DISABLEALBEDO, L"Disable albedo", 35, iY += 24, 160, 22, g_DisableAlbedo );
g_SampleUI.AddCheckBox( IDC_PAUSEANIMATION, L"Pause animation", 35, iY += 24, 160, 22, g_PauseAnimation );
g_SampleUI.AddCheckBox( IDC_DISABLESKINING, L"Disable skining", 35, iY += 24, 160, 22, g_DisableSkining );
g_SampleUI.AddCheckBox( IDC_SHOWNORMALS, L"Show normals", 35, iY += 24, 160, 22, g_ShowNormals );
CDXUTComboBox* pCombo;
g_SampleUI.AddComboBox( IDC_TECHNIQUECOMBO, 35, iY += 30, 160, 22, 0, false, &pCombo );
if( pCombo )
{
pCombo->SetDropHeight( 100 );
pCombo->AddItem( L"Unpacked TBN", ( LPVOID )0x0 );
pCombo->AddItem( L"Packed TBN", ( LPVOID )0x1 );
pCombo->AddItem( L"Unpacked Quaternion", ( LPVOID )0x2 );
pCombo->AddItem( L"Packed Quaternion", ( LPVOID )0x3 );
pCombo->SetSelectedByIndex(g_TechniqueIndex);
}
iY = 10;
D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &g_pFont9 );
d3dAnimation.Create(pd3dDevice);
d3dMesh.Create(pd3dDevice);
d3dFloor.Create(pd3dDevice);
FBXImporter importer;
const char* fbxFileName = ".\\data\\MilitaryMechanic.fbx";
importer.Import(fbxFileName, &d3dMesh, &d3dAnimation);
return S_OK;
}
示例2: FillProfiles
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));
}
示例3: UpdateMSAASampleCounts
//--------------------------------------------------------------------------------------
// 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 ) );
}
示例4: InitGUI
//--------------------------------------------------------------------------------------
//
//--------------------------------------------------------------------------------------
void InitGUI()
{
// Initialize dialogs
g_SettingsDlg.Init(&g_DialogResourceManager);
g_HUD.Init(&g_DialogResourceManager);
g_HUD.SetCallback(OnGUIEvent);
g_TextRenderer.Init(&g_DialogResourceManager);
int iY = 10;
g_HUD.AddButton (IDC_TOGGLEFULLSCREEN, L"Toggle full screen" , 35, iY, 160, 22);
g_HUD.AddButton (IDC_TOGGLEREF, L"Toggle REF (F3)" , 35, iY += 24, 160, 22, VK_F3);
g_HUD.AddButton (IDC_CHANGEDEVICE, L"Change device (F2)" , 35, iY += 24, 160, 22, VK_F2);
iY += 20;
g_HUD.AddCheckBox(IDC_DEINTERLEAVE, L"Deinterleaved Texturing", 35, iY += 28, 125, 22, g_UseDeinterleavedTexturing);
g_HUD.AddCheckBox(IDC_RANDOMIZE, L"Randomize Samples", 35, iY += 28, 125, 22, g_RandomizeSamples);
g_HUD.AddCheckBox(IDC_BLUR_AO, L"Blur AO", 35, iY += 28, 125, 22, g_BlurAO);
iY += 24;
CDXUTComboBox *pComboBox;
g_HUD.AddComboBox(IDC_CHANGESCENE, 35, iY += 24, 160, 22, 'M', false, &pComboBox);
for (int i = 0; i < ARRAYSIZE(g_MeshDesc); i++)
{
pComboBox->AddItem(g_MeshDesc[i].Name, NULL);
}
iY += 24;
WCHAR sz[100];
int dy = 20;
StringCchPrintf(sz, 100, UI_RADIUS_MULT L"%0.2f", g_AOParams.Radius);
g_HUD.AddStatic(IDC_RADIUS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_RADIUS_SLIDER, 50, iY += dy, 100, 22, 0, 100, int(g_AOParams.Radius / MAX_RADIUS_MULT * 100));
StringCchPrintf(sz, 100, UI_AO_BIAS L"%g", g_AOParams.Bias);
g_HUD.AddStatic(IDC_BIAS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BIAS_SLIDER, 50, iY += dy, 100, 22, 0, 500, int(g_AOParams.Bias * 1000));
StringCchPrintf(sz, 100, UI_POW_EXPONENT L"%0.2f", g_AOParams.PowerExponent);
g_HUD.AddStatic(IDC_EXPONENT_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_EXPONENT_SLIDER, 50, iY += dy, 100, 22, 0, 400, (int)(100.0f*g_AOParams.PowerExponent));
StringCchPrintf(sz, 100, UI_BLUR_SHARPNESS L"%0.2f", g_AOParams.Blur.Sharpness);
g_HUD.AddStatic(IDC_BLUR_SHARPNESS_STATIC, sz, 35, iY += dy, 125, 22);
g_HUD.AddSlider(IDC_BLUR_SHARPNESS_SLIDER, 50, iY += dy, 100, 22, 0, 1600, (int)(100.0f*g_AOParams.Blur.Sharpness));
UINT ButtonGroup = 0;
iY += 24;
g_HUD.AddRadioButton( IDC_1xMSAA, ButtonGroup, L"1X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_1X) );
g_HUD.AddRadioButton( IDC_2xMSAA, ButtonGroup, L"2X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_2X) );
g_HUD.AddRadioButton( IDC_4xMSAA, ButtonGroup, L"4X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_4X) );
g_HUD.AddRadioButton( IDC_8xMSAA, ButtonGroup, L"8X MSAA", 35, iY += 24, 125, 22, (g_MSAACurrentSettings == MSAA_MODE_8X) );
++ButtonGroup;
iY += 24;
g_HUD.AddRadioButton( IDC_PER_PIXEL_AO, ButtonGroup, L"PER_PIXEL_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_PIXEL_AO) );
g_HUD.AddRadioButton( IDC_PER_SAMPLE_AO, ButtonGroup, L"PER_SAMPLE_AO", 35, iY += 24, 125, 22, (g_AOParams.Output.MSAAMode == GFSDK_SSAO_PER_SAMPLE_AO) );
}
示例5: InitApp
// 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));
}
示例6: OnCreateDevice
//--------------------------------------------------------------------------------------
// This callback function will be called immediately after the Direct3D device has been
// created, which will happen during application initialization and windowed/full screen
// toggles. This is the best location to create D3DPOOL_MANAGED resources since these
// resources need to be reloaded whenever the device is destroyed. Resources created
// here should be released in the OnDestroyDevice callback.
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
WCHAR str[MAX_PATH];
V_RETURN( g_DialogResourceManager.OnD3D9CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D9CreateDevice( pd3dDevice ) );
// Initialize the font
V_RETURN( D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont ) );
// Create the mesh and load it with data already gathered from a file
V_RETURN( g_MeshLoader.Create( pd3dDevice, L"media\\cup.obj" ) );
// Add the identified material subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); i++ )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )i );
}
// Define DEBUG_VS and/or DEBUG_PS to debug vertex and/or pixel shaders with the
// shader debugger. Debugging vertex shaders requires either REF or software vertex
// processing, and debugging pixel shaders requires REF. The
// D3DXSHADER_FORCE_*_SOFTWARE_NOOPT flag improves the debug experience in the
// shader debugger. It enables source level debugging, prevents instruction
// reordering, prevents dead code elimination, and forces the compiler to compile
// against the next higher available software target, which ensures that the
// unoptimized shaders do not exceed the shader model limitations. Setting these
// flags will cause slower rendering since the shaders will be unoptimized and
// forced into software. See the DirectX documentation for more information about
// using the shader debugger.
DWORD dwShaderFlags = D3DXFX_NOT_CLONEABLE;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3DXSHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3DXSHADER_DEBUG;
#endif
#ifdef DEBUG_VS
dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
#endif
#ifdef DEBUG_PS
dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
#endif
// Read the D3DX effect file
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ.fx" ) );
// If this fails, there should be debug output as to
// they the .fx file failed to compile
V_RETURN( D3DXCreateEffectFromFile( pd3dDevice, str, NULL, NULL, dwShaderFlags,
NULL, &g_pEffect, NULL ) );
// Cache the effect handles
g_hAmbient = g_pEffect->GetParameterBySemantic( 0, "Ambient" );
g_hDiffuse = g_pEffect->GetParameterBySemantic( 0, "Diffuse" );
g_hSpecular = g_pEffect->GetParameterBySemantic( 0, "Specular" );
g_hOpacity = g_pEffect->GetParameterBySemantic( 0, "Opacity" );
g_hSpecularPower = g_pEffect->GetParameterBySemantic( 0, "SpecularPower" );
g_hLightColor = g_pEffect->GetParameterBySemantic( 0, "LightColor" );
g_hLightPosition = g_pEffect->GetParameterBySemantic( 0, "LightPosition" );
g_hCameraPosition = g_pEffect->GetParameterBySemantic( 0, "CameraPosition" );
g_hTexture = g_pEffect->GetParameterBySemantic( 0, "Texture" );
g_hTime = g_pEffect->GetParameterBySemantic( 0, "Time" );
g_hWorld = g_pEffect->GetParameterBySemantic( 0, "World" );
g_hWorldViewProjection = g_pEffect->GetParameterBySemantic( 0, "WorldViewProjection" );
// Setup the camera's view parameters
D3DXVECTOR3 vecEye( 2.0f, 1.0f, 0.0f );
D3DXVECTOR3 vecAt ( 0.0f, 0.0f, -0.0f );
g_Camera.SetViewParams( &vecEye, &vecAt );
return S_OK;
}
示例7: InitApp
static void InitApp()
{
g_pCamManager = new S3UTCameraManager();
g_pCamManager->ConfigCameras("Cameras.txt");
g_pCamManager->DumpCameraStatus("DumpResult.txt");
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY, 125, 22, VK_F2 );
g_SampleUI.EnableKeyboardInput( true );
g_SampleUI.SetCallback( OnGUIEvent );
iY = 10;
g_SampleUI.AddStatic( IDC_SHADOW_ALGORITHM_LABEL, L"Shadow algorithm:", 35, iY, 125, 22 );
CDXUTComboBox *pComboBox;
g_SampleUI.AddComboBox( IDC_SHADOW_ALGORITHM, 35, iY += 20, 125, 30, 0, false, &pComboBox);
pComboBox->AddItem(L"StandardBP", NULL);
pComboBox->AddItem(L"BP_MSSM_KERNEL", NULL);
pComboBox->AddItem(L"STD_VSM", NULL);
pComboBox->AddItem(L"MipVSM", NULL);
pComboBox->AddItem(L"HirBP", NULL);
pComboBox->AddItem(L"BPGI", NULL);
pComboBox->AddItem(L"NoShadows", NULL);
pComboBox->AddItem(L"SingleLight", NULL);
pComboBox->AddItem(L"PCSS", NULL);
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light Zn", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_ZN, 160, iY, 124, 22, 0, 100, g_fCtrledLightZn*5 );
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light Zf", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_ZF, 160, iY, 124, 22, 0, 100, g_fCtrledLightZf - 10 );
g_SampleUI.AddStatic( IDC_COMMON_LABEL, L"Light FOV", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_FOV, 160, iY, 124, 22, 0, 100, g_fCtrledLightFov * 100 );
g_SampleUI.AddStatic( IDC_LIGHT_SIZE_LABEL, L"Light source size:", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_SIZE, 160, iY, 124, 22, 0, 100, 0 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"NumLightSample", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_NUM_LIGHT_SAMPLE, 160, iY, 124, 22, 0, 16, 0 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"fDefaultDepthBias", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_fDefaultDepthBias, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"3rd depth delta", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_BIAS_3RD_DEPTH, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddStatic(IDC_COMMON_LABEL, L"1st depth delta", 35, iY += 25, 125, 22 );
g_SampleUI.AddSlider(IDC_BIAS_1ST_DEPTH, 160, iY, 124, 22, 0, 100, 40 );
g_SampleUI.AddCheckBox( IDC_BTEXTURED, L"Enable Texturing", 15, iY += 25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_SHOW_3DWIDGET, L"Show 3D Widget", 150, iY, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_BMOVECAMERA, L"Move Camera", 15, iY += 25, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_FRAME_DUMP, L"Dump Frame", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_BDUMP_SHADOWMAP, L"Dump Shadow Map", 15, iY+=25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_BDUMP_LIGHT_PAR, L"Dump Light Para", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_STATIC, L"Freeze Model", 15, iY += 25, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_ANIMATE, L"Show Animated Model", 150, iY, 124, 22, false);
g_SampleUI.AddCheckBox( IDC_SCENE, L"Show scene", 15, iY += 25, 124, 22, true);
g_SampleUI.AddCheckBox( IDC_FAN, L"Show Fan", 150, iY, 124, 22, false);
g_CameraUI.Init( &g_DialogResourceManager );
g_CameraUI.EnableKeyboardInput( true );
g_CameraUI.SetCallback( OnGUIEvent );
{
g_pCamManager->SetupCameraUI( g_CameraUI );
}
}
示例8: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent );
g_SampleUI.SetFont( 1, L"Comic Sans MS", 24, FW_NORMAL );
g_SampleUI.SetFont( 2, L"Courier New", 16, FW_NORMAL );
// Static
g_SampleUI.AddStatic( IDC_STATIC, L"This is a static control.", 0, 0, 200, 30 );
g_SampleUI.AddStatic( IDC_OUTPUT,
L"This static control provides feedback for your action. It will change as you interact with the UI controls.", 20, 50, 620, 300 );
g_SampleUI.GetStatic( IDC_OUTPUT )->SetTextColor( D3DCOLOR_ARGB( 255, 255, 0, 0 ) ); // Change color to red
g_SampleUI.GetStatic( IDC_STATIC )->SetTextColor( D3DCOLOR_ARGB( 255, 0, 255, 0 ) ); // Change color to green
g_SampleUI.GetControl( IDC_OUTPUT )->GetElement( 0 )->dwTextFormat = DT_LEFT | DT_TOP | DT_WORDBREAK;
g_SampleUI.GetControl( IDC_OUTPUT )->GetElement( 0 )->iFont = 2;
g_SampleUI.GetControl( IDC_STATIC )->GetElement( 0 )->dwTextFormat = DT_CENTER | DT_VCENTER | DT_WORDBREAK;
// Buttons
g_SampleUI.AddButton( IDC_ENABLEIME, L"Enable (I)ME", 30, 390, 80, 35, L'I' );
g_SampleUI.AddButton( IDC_DISABLEIME, L"Disable I(M)E", 30, 430, 80, 35, L'M' );
// Edit box
g_SampleUI.AddEditBox( IDC_EDITBOX1, L"Edit control with default styles. Type text here and press Enter", 20, 440,
600, 32 );
// IME-enabled edit box
CDXUTIMEEditBox* pIMEEdit;
CDXUTIMEEditBox::InitDefaultElements( &g_SampleUI );
if( SUCCEEDED( CDXUTIMEEditBox::CreateIMEEditBox( &g_SampleUI, IDC_EDITBOX2,
L"IME-capable edit control with custom styles. Type and press Enter", 20, 390, 600, 45, false, &pIMEEdit ) ) )
{
g_SampleUI.AddControl( pIMEEdit );
pIMEEdit->GetElement( 0 )->iFont = 1;
pIMEEdit->GetElement( 1 )->iFont = 1;
pIMEEdit->GetElement( 9 )->iFont = 1;
pIMEEdit->GetElement( 0 )->TextureColor.Init( D3DCOLOR_ARGB( 128, 255, 255, 255 ) ); // Transparent center
pIMEEdit->SetBorderWidth( 7 );
pIMEEdit->SetTextColor( D3DCOLOR_ARGB( 255, 64, 64, 64 ) );
pIMEEdit->SetCaretColor( D3DCOLOR_ARGB( 255, 64, 64, 64 ) );
pIMEEdit->SetSelectedTextColor( D3DCOLOR_ARGB( 255, 255, 255, 255 ) );
pIMEEdit->SetSelectedBackColor( D3DCOLOR_ARGB( 255, 40, 72, 72 ) );
}
// Slider
g_SampleUI.AddSlider( IDC_SLIDER, 200, 450, 200, 24, 0, 100, 50, false );
// Checkbox
g_SampleUI.AddCheckBox( IDC_CHECKBOX, L"This is a checkbox with hotkey. Press 'C' to toggle the check state.",
170, 450, 350, 24, false, L'C', false );
g_SampleUI.AddCheckBox( IDC_CLEAREDIT,
L"This checkbox controls whether edit control text is cleared when Enter is pressed. (T)",
170, 460, 450, 24, false, L'T', false );
// Combobox
CDXUTComboBox* pCombo;
g_SampleUI.AddComboBox( IDC_COMBOBOX, 0, 0, 200, 24, L'O', false, &pCombo );
if( pCombo )
{
pCombo->SetDropHeight( 100 );
pCombo->AddItem( L"Combobox item (O)", ( LPVOID )0x11111111 );
pCombo->AddItem( L"Placeholder (O)", ( LPVOID )0x12121212 );
pCombo->AddItem( L"One more (O)", ( LPVOID )0x13131313 );
pCombo->AddItem( L"I can't get enough (O)", ( LPVOID )0x14141414 );
pCombo->AddItem( L"Ok, last one, I promise (O)", ( LPVOID )0x15151515 );
}
// Radio buttons
g_SampleUI.AddRadioButton( IDC_RADIO1A, 1, L"Radio group 1 Amy (1)", 0, 50, 220, 24, false, L'1' );
g_SampleUI.AddRadioButton( IDC_RADIO1B, 1, L"Radio group 1 Brian (2)", 0, 50, 220, 24, false, L'2' );
g_SampleUI.AddRadioButton( IDC_RADIO1C, 1, L"Radio group 1 Clark (3)", 0, 50, 220, 24, false, L'3' );
g_SampleUI.AddRadioButton( IDC_RADIO2A, 2, L"Single (4)", 0, 50, 90, 24, false, L'4' );
g_SampleUI.AddRadioButton( IDC_RADIO2B, 2, L"Double (5)", 0, 50, 90, 24, false, L'5' );
g_SampleUI.AddRadioButton( IDC_RADIO2C, 2, L"Triple (6)", 0, 50, 90, 24, false, L'6' );
// List box
g_SampleUI.AddListBox( IDC_LISTBOX, 30, 400, 200, 150, 0 );
for( int i = 0; i < 15; ++i )
{
WCHAR wszText[50];
swprintf_s( wszText, 50, L"Single-selection listbox item %d", i );
g_SampleUI.GetListBox( IDC_LISTBOX )->AddItem( wszText, ( LPVOID )( size_t )i );
}
g_SampleUI.AddListBox( IDC_LISTBOXM, 30, 400, 200, 150, CDXUTListBox::MULTISELECTION );
for( int i = 0; i < 30; ++i )
{
WCHAR wszText[50];
//.........这里部分代码省略.........
示例9: if
//--------------------------------------------------------------------------------------
// Create any D3D10 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont10 ) );
V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) );
g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 );
// Read the D3DX effect file
WCHAR str[MAX_PATH];
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ10.fx" ) );
DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3D10_SHADER_DEBUG;
#endif
V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL,
NULL, &g_pEffect10, NULL, NULL ) );
// Obtain the technique
g_pTechnique = g_pEffect10->GetTechniqueByName( "NoSpecular" );
g_ptxDiffuseVariable = g_pEffect10->GetVariableByName( "g_MeshTexture" )->AsShaderResource();
g_pAmbient = g_pEffect10->GetVariableByName( "g_vMaterialAmbient" )->AsVector();
g_pDiffuse = g_pEffect10->GetVariableByName( "g_vMaterialDiffuse" )->AsVector();
g_pSpecular = g_pEffect10->GetVariableByName( "g_vMaterialSpecular" )->AsVector();
g_pOpacity = g_pEffect10->GetVariableByName( "g_fMaterialAlpha" )->AsScalar();
g_pSpecularPower = g_pEffect10->GetVariableByName( "g_nMaterialShininess" )->AsScalar();
g_pLightColor = g_pEffect10->GetVariableByName( "g_vLightColor" )->AsVector();
g_pLightPosition = g_pEffect10->GetVariableByName( "g_vLightPosition" )->AsVector();
g_pCameraPosition = g_pEffect10->GetVariableByName( "g_vCameraPosition" )->AsVector();
g_pTime = g_pEffect10->GetVariableByName( "g_fTime" )->AsScalar();
g_pWorld = g_pEffect10->GetVariableByName( "g_mWorld" )->AsMatrix();
g_pWorldViewProjection = g_pEffect10->GetVariableByName( "g_mWorldViewProjection" )->AsMatrix();
// Define the input layout
const D3D10_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
} ;
UINT numElements = sizeof( layout ) / sizeof( layout[0] );
// Create the input layout
D3D10_PASS_DESC PassDesc;
g_pTechnique->GetPassByIndex( 0 )->GetDesc( &PassDesc );
V_RETURN( pd3dDevice->CreateInputLayout( layout, numElements, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &g_pVertexLayout ) );
pd3dDevice->IASetInputLayout( g_pVertexLayout );
// Load the mesh
V_RETURN( g_MeshLoader.Create( pd3dDevice, MESHFILEPATH ) );
// Add the identified subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for ( UINT subset = 0; subset < g_MeshLoader.GetNumSubsets(); ++subset )
{
Material* pMaterial = g_MeshLoader.GetSubsetMaterial( subset );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )subset );
}
// Store the correct technique for each material
for ( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); ++i )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
const char* strTechnique = "";
if( pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "TexturedSpecular";
else if( pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "TexturedNoSpecular";
else if( !pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "Specular";
else if( !pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "NoSpecular";
pMaterial->pTechnique = g_pEffect10->GetTechniqueByName( strTechnique );
}
LoadRasterizerStates(pd3dDevice);
//.........这里部分代码省略.........
示例10: InitApp
void AMD::InitApp( ShaderCache& r_ShaderCache, HUD& r_HUD, int& iY, const bool i_bAdvancedShaderCacheGUI_VisibleByDefault )
{
#if !AMD_SDK_PREBUILT_RELEASE_EXE
g_bAdvancedShaderCacheGUI_IsVisible = i_bAdvancedShaderCacheGUI_VisibleByDefault;
const int i_old_iY = iY;
g_pHUD = &r_HUD;
g_pShaderCache = &r_ShaderCache;
{
r_HUD.m_GUI.AddButton( GetEnum(AMD_IDC_BUTTON_SHOW_SHADERCACHE_UI), L"ShaderCache HUD (F9)", AMD::HUD::iElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, VK_F9 );
iY = 0;
static const int iSCElementOffset = AMD::HUD::iElementOffset - 256;
r_HUD.m_GUI.AddButton( GetEnum(AMD_IDC_BUTTON_RECOMPILESHADERS_CHANGED), L"Recompile shaders (F5)", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, VK_F5 );
#if AMD_SDK_INTERNAL_BUILD
if( r_ShaderCache.GenerateISAGPRPressure() )
{
r_HUD.m_GUI.AddButton( GetEnum(AMD_IDC_BUTTON_RECREATE_SHADERS), L"Gen |ISA| shaders (F6)", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, VK_F6 );
}
#endif
r_HUD.m_GUI.AddButton( GetEnum(AMD_IDC_BUTTON_RECOMPILESHADERS_GLOBAL), L"Build ALL shaders (F7)", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, VK_F7 );
r_HUD.m_GUI.AddCheckBox( GetEnum(AMD_IDC_CHECKBOX_AUTORECOMPILE_SHADERS), L"Auto Recompile Shaders", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, r_ShaderCache.RecompileTouchedShaders() );
if( r_ShaderCache.ShaderErrorDisplayType() == ShaderCache::ERROR_DISPLAY_ON_SCREEN )
{
r_HUD.m_GUI.AddCheckBox( GetEnum(AMD_IDC_CHECKBOX_SHOW_SHADER_ERRORS), L"Show Compiler Errors", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, r_ShaderCache.ShowShaderErrors() );
}
#if AMD_SDK_INTERNAL_BUILD
if( r_ShaderCache.GenerateISAGPRPressure() )
{
r_HUD.m_GUI.AddCheckBox( GetEnum(AMD_IDC_CHECKBOX_SHOW_ISA_GPR_PRESSURE), L"Show ISA GPR Pressure", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, r_ShaderCache.ShowISAGPRPressure() );
r_HUD.m_GUI.AddStatic( GetEnum(AMD_IDC_STATIC_TARGET_ISA), L"Target ISA:", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight );
CDXUTComboBox *pCombo;
r_HUD.m_GUI.AddComboBox( GetEnum(AMD_IDC_COMBOBOX_TARGET_ISA), iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, 0, true, &pCombo );
if( pCombo )
{
pCombo->SetDropHeight( 300 );
for( int i = AMD::FIRST_ISA_TARGET; i < AMD::NUM_ISA_TARGETS; ++i )
{
pCombo->AddItem( AMD::AmdTargetInfo[ i ].m_Name, NULL );
}
pCombo->SetSelectedByIndex( AMD::DEFAULT_ISA_TARGET );
}
r_HUD.m_GUI.AddStatic( GetEnum(AMD_IDC_STATIC_TARGET_ISA_INFO), L"Press (F6) to add New ISA", iSCElementOffset, iY += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight );
}
#endif
}
SetHUDVisibility( r_HUD, i_bAdvancedShaderCacheGUI_VisibleByDefault );
iY = i_old_iY + AMD::HUD::iElementDelta;
#endif
}
示例11: if
//--------------------------------------------------------------------------------------
// Create any D3D10 resources that aren't dependant on the back buffer
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D10CreateDevice( ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBufferSurfaceDesc,
void* pUserContext )
{
HRESULT hr;
V_RETURN( g_DialogResourceManager.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( g_SettingsDlg.OnD3D10CreateDevice( pd3dDevice ) );
V_RETURN( D3DX10CreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
L"Arial", &g_pFont10 ) );
V_RETURN( D3DX10CreateSprite( pd3dDevice, 512, &g_pSprite10 ) );
g_pTxtHelper = new CDXUTTextHelper( NULL, NULL, g_pFont10, g_pSprite10, 15 );
// Read the D3DX effect file
WCHAR str[MAX_PATH];
V_RETURN( DXUTFindDXSDKMediaFileCch( str, MAX_PATH, L"MeshFromOBJ10.fx" ) );
DWORD dwShaderFlags = D3D10_SHADER_ENABLE_STRICTNESS;
#if defined( DEBUG ) || defined( _DEBUG )
// Set the D3D10_SHADER_DEBUG flag to embed debug information in the shaders.
// Setting this flag improves the shader debugging experience, but still allows
// the shaders to be optimized and to run exactly the way they will run in
// the release configuration of this program.
dwShaderFlags |= D3D10_SHADER_DEBUG;
#endif
V_RETURN( D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL,
NULL, &g_pEffect10, NULL, NULL ) );
// Obtain the technique
g_pTechnique = g_pEffect10->GetTechniqueByName( "NoSpecular" );
g_ptxDiffuseVariable = g_pEffect10->GetVariableByName( "g_MeshTexture" )->AsShaderResource();
g_pAmbient = g_pEffect10->GetVariableByName( "g_vMaterialAmbient" )->AsVector();
g_pDiffuse = g_pEffect10->GetVariableByName( "g_vMaterialDiffuse" )->AsVector();
g_pSpecular = g_pEffect10->GetVariableByName( "g_vMaterialSpecular" )->AsVector();
g_pOpacity = g_pEffect10->GetVariableByName( "g_fMaterialAlpha" )->AsScalar();
g_pSpecularPower = g_pEffect10->GetVariableByName( "g_nMaterialShininess" )->AsScalar();
g_pLightColor = g_pEffect10->GetVariableByName( "g_vLightColor" )->AsVector();
g_pLightPosition = g_pEffect10->GetVariableByName( "g_vLightPosition" )->AsVector();
g_pCameraPosition = g_pEffect10->GetVariableByName( "g_vCameraPosition" )->AsVector();
g_pTime = g_pEffect10->GetVariableByName( "g_fTime" )->AsScalar();
g_pWorld = g_pEffect10->GetVariableByName( "g_mWorld" )->AsMatrix();
g_pWorldViewProjection = g_pEffect10->GetVariableByName( "g_mWorldViewProjection" )->AsMatrix();
// Define the input layout
const D3D10_INPUT_ELEMENT_DESC layout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
} ;
UINT numElements = sizeof( layout ) / sizeof( layout[0] );
// Create the input layout
D3D10_PASS_DESC PassDesc;
g_pTechnique->GetPassByIndex( 0 )->GetDesc( &PassDesc );
V_RETURN( pd3dDevice->CreateInputLayout( layout, numElements, PassDesc.pIAInputSignature,
PassDesc.IAInputSignatureSize, &g_pVertexLayout ) );
pd3dDevice->IASetInputLayout( g_pVertexLayout );
// Load the mesh
V_RETURN( g_MeshLoader.Create( pd3dDevice, L"media\\cup.obj" ) );
// Add the identified subsets to the UI
CDXUTComboBox* pComboBox = g_SampleUI.GetComboBox( IDC_SUBSET );
pComboBox->RemoveAllItems();
pComboBox->AddItem( L"All", ( void* )( INT_PTR )-1 );
for ( UINT subset = 0; subset < g_MeshLoader.GetNumSubsets(); ++subset )
{
Material* pMaterial = g_MeshLoader.GetSubsetMaterial( subset );
pComboBox->AddItem( pMaterial->strName, ( void* )( INT_PTR )subset );
}
// Store the correct technique for each material
for ( UINT i = 0; i < g_MeshLoader.GetNumMaterials(); ++i )
{
Material* pMaterial = g_MeshLoader.GetMaterial( i );
const char* strTechnique = "";
if( pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "TexturedSpecular";
else if( pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "TexturedNoSpecular";
else if( !pMaterial->pTextureRV10 && pMaterial->bSpecular )
strTechnique = "Specular";
else if( !pMaterial->pTextureRV10 && !pMaterial->bSpecular )
strTechnique = "NoSpecular";
pMaterial->pTechnique = g_pEffect10->GetTechniqueByName( strTechnique );
}
// Setup the camera's view parameters
D3DXVECTOR3 vecEye( 2.0f, 1.0f, 0.0f );
//.........这里部分代码省略.........