本文整理汇总了C++中CDXUTDialog::AddSlider方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::AddSlider方法的具体用法?C++ CDXUTDialog::AddSlider怎么用?C++ CDXUTDialog::AddSlider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTDialog
的用法示例。
在下文中一共展示了CDXUTDialog::AddSlider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SampleUI.Init(&g_DialogResourceManager);
int iY = 10;
g_SampleUI.SetCallback(OnGUIEvent); iY = 10;
g_SampleUI.AddStatic(IDC_STATIC_TIMESCALE, L"Time scale", 50, iY, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_TIMESCALE, 50, iY += 16, 100, 22);
g_SampleUI.AddStatic(IDC_STATIC_WEIGHT, L"idle / Walk / run", 50, iY += 20, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_WEIGHT, 50, iY += 16, 100, 22, 0, 100, 0);
g_SampleUI.AddCheckBox(IDC_CHECK_RAGDOLL, L"Ragdoll", 50, iY += 20, 100, 22, false);
g_SampleUI.AddCheckBox(IDC_CHECK_GPU_SKINNING, L"GPU Skinning", 50, iY += 30, 100, 22, false);
g_SampleUI.AddCheckBox(IDC_CHECK_DIFFUSEMAP, L"Diffusemap", 50, iY += 30, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_NORMALMAP, L"Normalmap", 50, iY += 20, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_GLOSS, L"Glossmap", 50, iY += 20, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_WIREFRAME, L"Wireframe", 50, iY += 20, 100, 22);
g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_NORMAL, L"Draw Normal", 50, iY += 20, 100, 22, false);
g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_SKELETON, L"Draw Skeleton", 50, iY += 20, 100, 22, false);
g_SampleUI.AddCheckBox(IDC_CHECK_DRAW_BOUNDINGBOX, L"Draw Bounding", 50, iY += 20, 100, 22, false);
g_SampleUI.AddButton(IDC_BUTTON_ATTACK, L"Attack", 50, iY += 25, 100, 22);
}
示例2: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_SampleUI.Init(&g_DialogResourceManager);
int iY = 10;
g_SampleUI.SetCallback(OnGUIEvent); iY = 10;
g_SampleUI.AddStatic(IDC_STATIC_TIMESCALE, L"Time scale", 50, iY, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_TIMESCALE, 50, iY += 16, 100, 22);
g_SampleUI.AddStatic(IDC_STATIC_WEIGHT, L"idle / Walk / run", 50, iY += 20, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_WEIGHT, 50, iY += 16, 100, 22, 0, 100, 0);
g_SampleUI.AddStatic(IDC_STATIC_ARM, L"arm", 50, iY += 40, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_ARM, 50, iY += 16, 100, 22, 0, 100, 50);
g_SampleUI.AddStatic(IDC_STATIC_LEG, L"leg", 50, iY += 20, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_LEG, 50, iY += 16, 100, 22, 0, 100, 50);
g_SampleUI.AddStatic(IDC_STATIC_BODY, L"body", 50, iY += 20, 100, 24);
g_SampleUI.AddSlider(IDC_SLIDER_BODY, 50, iY += 16, 100, 22, 0, 100, 50);
g_SampleUI.AddCheckBox(IDC_CHECK_DIFFUSEMAP, L"Diffusemap", 50, iY += 40, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_NORMALMAP, L"Normalmap", 50, iY += 20, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_GLOSS, L"Glossmap", 50, iY += 20, 100, 22, true);
g_SampleUI.AddCheckBox(IDC_CHECK_WIREFRAME, L"Wireframe", 50, iY += 20, 100, 22);
}
示例3: 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) );
}
示例4: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
displacement_level = 1.5;
tess_lvl = 80;
drawwire = false;
D3DXVECTOR3 vLightDir( -1, 1, -1 );
D3DXVec3Normalize( &vLightDir, &vLightDir );
g_LightControl.SetLightDirection( vLightDir );
// Initialize dialogs
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_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 23 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 23, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent );
iY = -30;
WCHAR sz[100];
//iY += 24;
swprintf_s( sz, L"Tessellation Level: %2.1f", tess_lvl );
g_SampleUI.AddStatic( IDC_TESSLVL_STATIC, sz, -10, iY += 26, 150, 22 );
g_SampleUI.AddSlider( IDC_TESSLVL, 10, iY += 24, 150, 22, 1, 80, tess_lvl );
iY += 14;
swprintf_s( sz, L"Displacement Level: %2.1f", displacement_level );
g_SampleUI.AddStatic( IDC_DISPLACEMENTLVL_STATIC, sz, -10, iY += 26, 150, 22 );
g_SampleUI.AddSlider( IDC_DISPLACEMENTLVL, 10, iY += 24, 150, 22, 0, 150, (float)(displacement_level)/ 100.0f );
iY += 10;
g_SampleUI.AddCheckBox( IDC_TOGGLEWIRE, L"Toggle Wires", 20, iY += 26, 150, 22, drawwire );
iY += 10;
g_SampleUI.AddCheckBox( IDC_TOGGLEDT, L"Toggle Distanced Based tesselation", -120, iY += 26, 150, 22, true );
iY += 10;
g_SampleUI.AddRadioButton( IDC_PARTITION_INTEGER, IDC_PARTITION_MODE, L"Integer", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_EVEN, IDC_PARTITION_MODE, L"Fractional Even", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_ODD, IDC_PARTITION_MODE, L"Fractional Odd", 20, iY += 26, 170, 22 );
g_SampleUI.GetRadioButton( IDC_PARTITION_INTEGER )->SetChecked( true );
iY += 10;
g_SampleUI.AddCheckBox( IDC_TOGGLEBUILDING, L"Toggle buildings", 20, iY += 26, 150, 22, true );
}
示例5: initApp
void initApp() {
hud.Init(&dialogResourceManager);
hud.SetCallback(onGUIEvent); int iY = 10;
hud.AddButton(IDC_TOGGLE_FULLSCREEN, L"Toggle full screen", 35, iY, HUD_WIDTH, 22);
iY += 24;
hud.AddComboBox(IDC_PRESET, 35, iY += 24, HUD_WIDTH, 22, 0, false);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Low", (LPVOID) 0);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Medium", (LPVOID) 1);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA High", (LPVOID) 2);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Ultra", (LPVOID) 3);
hud.GetComboBox(IDC_PRESET)->AddItem(L"SMAA Custom", (LPVOID) 4);
hud.GetComboBox(IDC_PRESET)->SetSelectedByData((LPVOID) 2);
hud.AddComboBox(IDC_DETECTION_MODE, 35, iY += 24, HUD_WIDTH, 22, 0, false);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Luma edge det.", (LPVOID) 0);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Color edge det.", (LPVOID) 1);
hud.GetComboBox(IDC_DETECTION_MODE)->AddItem(L"Depth edge det.", (LPVOID) 2);
hud.AddCheckBox(IDC_ANTIALIASING, L"SMAA Anti-Aliasing", 35, iY += 24, HUD_WIDTH, 22, true);
hud.AddCheckBox(IDC_PROFILE, L"Profile", 35, iY += 24, 125, 22, false);
wstringstream s;
s << L"Threshold: " << commandlineOptions.threshold;
hud.AddStatic(IDC_THRESHOLD_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_THRESHOLD, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.threshold / 0.5f));
hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(false);
hud.GetSlider(IDC_THRESHOLD)->SetVisible(false);
s = wstringstream();
s << L"Max Search Steps: " << commandlineOptions.searchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.searchSteps / 98.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(false);
s = wstringstream();
s << L"Max Diag. Search Steps: " << commandlineOptions.diagSearchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS_DIAG, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.diagSearchSteps / 20.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(false);
s = wstringstream();
s << L"Corner Rounding: " << commandlineOptions.cornerRounding;
hud.AddStatic(IDC_CORNER_ROUNDING_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_CORNER_ROUNDING, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.cornerRounding / 100.0f));
hud.GetStatic(IDC_CORNER_ROUNDING_LABEL)->SetVisible(false);
hud.GetSlider(IDC_CORNER_ROUNDING)->SetVisible(false);
}
示例6: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
g_bSpinning = true;
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_TOGGLEFULLSCREEN, L"Toggle full screen", 35, iY, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 35, iY += 24, 125, 22, VK_F2 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 35, iY += 24, 125, 22, VK_F3 );
g_HUD.AddButton( IDC_TOGGLEWARP, L"Toggle WARP (F4)", 35, iY += 24, 125, 22, VK_F4 );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
WCHAR sz[100];
iY += 24;
swprintf_s( sz, 100, L"Explode Amount: %0.2f", g_fExplode );
g_SampleUI.AddStatic( IDC_EXPLODE_STATIC, sz, 35, iY += 24, 125, 22 );
g_SampleUI.AddSlider( IDC_EXPLODE_SCALE, 50, iY += 24, 100, 22, 0, 3000, ( int )( g_fExplode * 100.0f ) );
iY += 24;
g_SampleUI.AddCheckBox( IDC_TOGGLESPIN, L"Toggle Spinning", 35, iY += 24, 125, 22, g_bSpinning );
}
示例7: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 20;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 22, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent ); iY = 10;
WCHAR sz[100];
iY += 24;
swprintf_s( sz, L"Patch Divisions: %2.1f", g_fSubdivs );
g_SampleUI.AddStatic( IDC_PATCH_SUBDIVS_STATIC, sz, 10, iY += 26, 150, 22 );
g_SampleUI.AddSlider( IDC_PATCH_SUBDIVS, 10, iY += 24, 150, 22, 10 * MIN_DIVS, 10 * MAX_DIVS, (int)(g_fSubdivs * 10) );
iY += 24;
g_SampleUI.AddCheckBox( IDC_TOGGLE_LINES, L"Toggle Wires", 20, iY += 26, 150, 22, g_bDrawWires );
iY += 24;
g_SampleUI.AddRadioButton( IDC_PARTITION_INTEGER, IDC_PARTITION_MODE, L"Integer", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_EVEN, IDC_PARTITION_MODE, L"Fractional Even", 20, iY += 26, 170, 22 );
g_SampleUI.AddRadioButton( IDC_PARTITION_FRAC_ODD, IDC_PARTITION_MODE, L"Fractional Odd", 20, iY += 26, 170, 22 );
g_SampleUI.GetRadioButton( IDC_PARTITION_INTEGER )->SetChecked( true );
// Setup the camera's view parameters
static const XMVECTORF32 s_vecEye = { 1.0f, 1.5f, -3.5f, 0.f };
static const XMVECTORF32 s_vecAt = { 0.0f, 0.0f, 0.0f, 0.f };
g_Camera.SetViewParams( s_vecEye, s_vecAt );
}
示例8:
Slider::Slider( CDXUTDialog& dialog, int id, int& y, const wchar_t* label, int min, int max, int& value ) :
m_Value( value ),
m_szLabel( label )
{
dialog.AddStatic( id + 1000000, L"", AMD::HUD::iElementOffset, y += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, false, &m_pLabel );
dialog.AddSlider( id, AMD::HUD::iElementOffset, y += AMD::HUD::iElementDelta, AMD::HUD::iElementWidth, AMD::HUD::iElementHeight, min, max, m_Value, false, &m_pSlider );
dialog.AddControl( this );
OnGuiEvent();
}
示例9: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
g_bEnablePreshader = true;
for( int i = 0; i < MAX_LIGHTS; i++ )
g_LightControl[i].SetLightDirection( D3DXVECTOR3( sinf( D3DX_PI * 2 * i / MAX_LIGHTS - D3DX_PI / 6 ),
0, -cosf( D3DX_PI * 2 * i / MAX_LIGHTS - D3DX_PI / 6 ) ) );
g_nActiveLight = 0;
g_nNumActiveLights = 1;
g_fLightScale = 1.0f;
// 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 ); iY = 10;
WCHAR sz[100];
iY += 24;
swprintf_s( sz, 100, L"# Lights: %d", g_nNumActiveLights );
g_SampleUI.AddStatic( IDC_NUM_LIGHTS_STATIC, sz, 35, iY += 24, 125, 22 );
g_SampleUI.AddSlider( IDC_NUM_LIGHTS, 50, iY += 24, 100, 22, 1, MAX_LIGHTS, g_nNumActiveLights );
iY += 24;
swprintf_s( sz, 100, L"Light scale: %0.2f", g_fLightScale );
g_SampleUI.AddStatic( IDC_LIGHT_SCALE_STATIC, sz, 35, iY += 24, 125, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_SCALE, 50, iY += 24, 100, 22, 0, 20, ( int )( g_fLightScale * 10.0f ) );
iY += 24;
g_SampleUI.AddButton( IDC_ACTIVE_LIGHT, L"Change active light (K)", 35, iY += 24, 125, 22, 'K' );
g_SampleUI.AddCheckBox( IDC_ENABLE_PRESHADER, L"Enable preshaders", 35, iY += 24, 125, 22, g_bEnablePreshader );
}
示例10: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
// Initialize dialogs
g_D3DSettingsDlg.Init(&g_DialogResourceManager);
g_HUD.Init(&g_DialogResourceManager);
g_SampleUI.Init(&g_DialogResourceManager);
g_HUD.SetCallback(OnGUIEvent);
int iY = 10;
g_SampleUI.SetCallback(OnGUIEvent);
iY = 0;
WCHAR sz[100];
StringCchPrintf(sz, 100, L"Diffusion steps: %d", 8);
g_SampleUI.AddStatic(IDC_DIFF_STEPS_STATIC, sz, 35, iY += 48, 125, 22);
g_SampleUI.AddSlider(IDC_DIFF_STEPS, 50, iY += 24, 100, 22, 0, 400, 4);
}
示例11: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
//g_LightControl.SetLightDirection( D3DXVECTOR3(-0.29f, 0.557f, 0.778f) );
g_LightControl.SetLightDirection( D3DXVECTOR3( -0.789f, 0.527f, 0.316f ) );
g_LightControl.SetButtonMask( MOUSE_MIDDLE_BUTTON );
// Initialize dialogs
g_SettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iX = 15; int iY = 10;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", iX, iY, 125, 22 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", iX, iY += 24, 125, 22 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", iX, iY += 24, 125, 22, VK_F2 );
g_SampleUI.SetCallback( OnGUIEvent ); iX = 15; iY = 10;
// Title font for static
g_SampleUI.SetFont( 1, L"Arial", 14, FW_NORMAL );
CDXUTElement* pElement = g_SampleUI.GetDefaultElement( DXUT_CONTROL_STATIC, 0 );
if( pElement )
{
pElement->iFont = 1;
pElement->dwTextFormat = DT_RIGHT | DT_VCENTER;
}
// Technique
g_SampleUI.AddStatic( -1, L"Technique", iX, iY += 24, 115, 22 );
g_SampleUI.AddComboBox( IDC_TECHNIQUE, iX + 125, iY, 150, 22 );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->SetScrollBarWidth( 0 );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->AddItem( L"Local-deformable PRT", ( void* )"LDPRT" );
g_SampleUI.GetComboBox( IDC_TECHNIQUE )->AddItem( L"N dot L lighting", ( void* )"NdotL" );
// Animation speed
iY += 10;
g_SampleUI.AddStatic( -1, L"Animation Speed", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_ANIMATION_SPEED, iX + 125, iY, 125, 22, 0, 3000, 700 );
// Light intensity
iY += 10;
g_SampleUI.AddStatic( -1, L"Light Intensity", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_LIGHT_SLIDER, iX + 125, iY, 125, 22, 0, 1000, 500 );
g_SampleUI.AddStatic( IDC_ENV_LABEL, L"Env Intensity", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_ENV_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 600 );
// Color transmission
iY += 10;
g_SampleUI.AddStatic( IDC_RED_TRANSMIT_LABEL, L"Transmit Red", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_RED_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 1200 );
g_SampleUI.AddStatic( IDC_GREEN_TRANSMIT_LABEL, L"Transmit Green", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_GREEN_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 800 );
g_SampleUI.AddStatic( IDC_BLUE_TRANSMIT_LABEL, L"Transmit Blue", iX, iY += 24, 115, 22 );
g_SampleUI.AddSlider( IDC_BLUE_TRANSMIT_SLIDER, iX + 125, iY, 125, 22, 0, 3000, 350 );
}
示例12: 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));
}
示例13: InitApp
//--------------------------------------------------------------------------------------
// Initialize the app
//--------------------------------------------------------------------------------------
void InitApp()
{
WCHAR temp[64];
g_D3DSettingsDlg.Init( &g_DialogResourceManager );
g_HUD.Init( &g_DialogResourceManager );
g_SampleUI.Init( &g_DialogResourceManager );
g_HUD.SetCallback( OnGUIEvent ); int iY = 30;
g_HUD.AddButton( IDC_TOGGLEFULLSCREEN, L"Toggle full screen", 0, iY, 170, 23 );
g_HUD.AddButton( IDC_TOGGLEREF, L"Toggle REF (F3)", 0, iY += 26, 170, 23, VK_F3 );
g_HUD.AddButton( IDC_CHANGEDEVICE, L"Change device (F2)", 0, iY += 26, 170, 23, VK_F2 );
iY += 180;
swprintf_s( temp, L"SunWidth = %2.2f", g_fSunWidth );
g_HUD.AddStatic( IDC_SUNWIDTH_TEXT, temp, 0, iY += 25, 100, 24 );
g_HUD.AddSlider( IDC_SUNWIDTH_SLIDER, 0, iY += 25, 150, 24, 0, 100, int( ( g_fSunWidth / 3.0 ) * 100 ) );
g_Camera.SetRotateButtons( true, false, false );
g_LCamera.SetButtonMasks( MOUSE_RIGHT_BUTTON, 0, 0 );
g_SampleUI.SetCallback( OnGUIEvent );
}
示例14: 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];
//.........这里部分代码省略.........
示例15: init
int init(PCALLBACKDXUTGUIEVENT on_gui_event, int spacing, UINT ew, UINT eh)
{
const int dd = spacing;
const int db = dd * 2;
// add to dialog manager
hud.Init(&dlg_manager);
hud_light.Init(&dlg_manager);
hud_gi.Init(&dlg_manager);
hud_postp1.Init(&dlg_manager);
hud_postp2.Init(&dlg_manager);
hud_debug_info.Init(&dlg_manager);
// set callbacks
hud.SetCallback(on_gui_event);
hud_light.SetCallback(on_gui_event);
hud_gi.SetCallback(on_gui_event);
hud_postp1.SetCallback(on_gui_event);
hud_postp2.SetCallback(on_gui_event);
hud_debug_info.SetCallback(on_gui_event);
int x = 0, y = 10, w = ew, h = eh;
hud.AddStatic(IDC_FPS_COUNTER, L"FPS: ", x, y, w, h);
hud.AddStatic(-1, L"Render targets:", x, y += db, w, h);
hud.AddComboBox(IDC_TARGETS, x, y += dd, w, h + 2, 0, false, &combo_render_targets);
hud.AddStatic(-1, L"Settings for:", x, y += db, w, h);
hud.AddComboBox(IDC_SETTINGS, x, y += dd, w, h + 2, 0, false, &combo_settings);
int start = y;
combo_settings->AddItem(L"", 0);
// Lights settings
y = start;
combo_settings->AddItem(L"Lights", reinterpret_cast<void*>(&hud_light));
hud_light.AddStatic(-1, L"Light direction:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_DIRECTION, x, y += dd, w, h);
hud_light.AddStatic(-1, L"Light position X/Y/Z:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_X, x, y += dd, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_Y, x, y += dd, w, h);
hud_light.AddSlider(IDC_LIGHT_POS_Z, x, y += dd, w, h);
hud_light.AddStatic(-1, L"Flux factor:", x, y += db, w, h);
hud_light.AddSlider(IDC_FLUX_SCALE, x, y += dd, w, h, 0, 1000, 100);
hud_light.AddStatic(-1, L"Warmth:", x, y += db, w, h);
hud_light.AddSlider(IDC_LIGHT_WARMTH, x, y += dd, w, h, 0, 100, 0);
// VPL settings
y = start;
combo_settings->AddItem(L"GI", reinterpret_cast<void*>(&hud_gi));
hud_gi.AddStatic(-1, L"GI scale:", x, y += db, w, h);
hud_gi.AddSlider(IDC_GI_SCALE, x, y += dd, w, h, 0, 100, 0);
#if defined(LPV) || defined(DLPV)
hud_gi.AddStatic(IDC_GI_INFO1, L"LPV propagations: 0", x, y += db, w, h);
hud_gi.AddSlider(IDC_GI_PARAMETER1, x, y += dd, w, h, 0, LPV_SIZE * 2, 0);
hud_gi.AddStatic(-1, L"LPV Flux amplifier:", x, y += db, w, h);
#else
hud_gi.AddStatic(-1, L"Surface roughness:", x, y += db, w, h);
#endif
hud_gi.AddSlider(IDC_GI_PARAMETER2, x, y += db, w, h, 0, 1000, 500);
hud_gi.AddCheckBox(IDC_GI_DEBUG1, L"Debug GI", x, y += db, w, h, false);
#if defined(LPV) || defined(DLPV)
hud_gi.AddCheckBox(IDC_GI_DEBUG2, L"Show LPV", x, y += db, w, h, false);
#endif
// Postprocessing 1 settings
y = start;
combo_settings->AddItem(L"Postprocess 1", reinterpret_cast<void*>(&hud_postp1));
hud_postp1.AddCheckBox(IDC_FXAA_ENABLED, L"FXAA", x, y += db, w, h, true);
hud_postp1.AddCheckBox(IDC_SSAO_ENABLED, L"SSAO", x, y += db, w, h, true);
hud_postp1.AddStatic(-1, L"SSAO factor:", x, y += db, w, h);
hud_postp1.AddSlider(IDC_SSAO_SCALE, x, y += dd, w, h, 0, 100, 10);
hud_postp1.AddCheckBox(IDC_GODRAYS_ENABLED, L"Godrays", x, y += db, w, h, false);
hud_postp1.AddStatic(-1, L"Godrays tau:", x, y += db, w, h);
hud_postp1.AddSlider(IDC_GODRAYS_TAU, x, y += dd, w, h, 1, 10, 5);
hud_postp1.AddCheckBox(IDC_EXPOSURE_ADAPT, L"Adapt exposure", x, y += db, w, h, false);
hud_postp1.AddStatic(-1, L"Exposure key value:", x, y += db, w, h, true);
hud_postp1.AddSlider(IDC_EXPOSURE_KEY, x, y += dd, w, h, 0, 100, 50);
hud_postp1.AddStatic(-1, L"Adaptation speed:", x, y += db, w, h, true);
hud_postp1.AddSlider(IDC_EXPOSURE_SPEED, x, y += dd, w, h, 1, 100, 20);
// Postprocessing 2 settings
y = start;
combo_settings->AddItem(L"Postprocess 2", reinterpret_cast<void*>(&hud_postp2));
hud_postp2.AddCheckBox(IDC_CRT_ENABLED, L"CRT monitor", x, y += db, w, h, false);
//.........这里部分代码省略.........