本文整理汇总了C++中CDXUTDialog::GetEditBox方法的典型用法代码示例。如果您正苦于以下问题:C++ CDXUTDialog::GetEditBox方法的具体用法?C++ CDXUTDialog::GetEditBox怎么用?C++ CDXUTDialog::GetEditBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDXUTDialog
的用法示例。
在下文中一共展示了CDXUTDialog::GetEditBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//--------------------------------------------------------------------------------------
// Create any D3D9 resources that won't live through a device reset (D3DPOOL_DEFAULT)
// or that are tied to the back buffer size
//--------------------------------------------------------------------------------------
HRESULT CALLBACK OnD3D9ResetDevice( IDirect3DDevice9* pd3dDevice,
const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
{
HRESULT hr;
V_RETURN( g_DialogResourceManager.OnD3D9ResetDevice() );
V_RETURN( g_SettingsDlg.OnD3D9ResetDevice() );
// Setup the camera's projection parameters
camera->OnResetDevice(pBackBufferSurfaceDesc);
g_HUD.SetLocation( pBackBufferSurfaceDesc->Width - 350, 0 );
g_HUD.SetSize( 360, 100 );
g_HUD.GetEditBox(IDC_CMD)->SetLocation(5,pBackBufferSurfaceDesc->Height-30);
g_HUD.GetStatic(IDC_STATIC7)->SetLocation(5,pBackBufferSurfaceDesc->Height-60);
g_SampleUI.SetLocation( pBackBufferSurfaceDesc->Width - 350, 130 );
g_SampleUI.SetSize( 350, pBackBufferSurfaceDesc->Height - 130 );
//clear black part of screen
clearRect.x1 = pBackBufferSurfaceDesc->Width - 360;
clearRect.y1 = 0;
clearRect.x2 = pBackBufferSurfaceDesc->Width;
clearRect.y2 = pBackBufferSurfaceDesc->Height;
return S_OK;
}
示例2: OnGUIEvent
//--------------------------------------------------------------------------------------
// Handles the GUI events
//--------------------------------------------------------------------------------------
void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
{
float val;
wchar_t str[512];
FILE* file2;
LPCWSTR ttext;
switch( nControlID )
{
//main menu
case IDC_TOGGLEFULLSCREEN:
DXUTToggleFullScreen();
break;
case IDC_SAVEFILE_BTN:
swprintf(str,L"./%s",g_HUD.GetEditBox( IDC_SAVEFILE )->GetText());
manipulator->SaveConfig(str);
break;
case IDC_NEWFILE_BTN:
swprintf(str,L"./%s",g_HUD.GetEditBox( IDC_NEWFILE )->GetText());
file2 = _wfopen(str,L"w+");
fclose(file2);
IniWrite(str,L"manipulator",L"chainsize",L"1");
IniWrite(str,L"chain_0",L"coefficient",L"0.8");
IniWrite(str,L"chain_0",L"direction",L"1.00");
IniWrite(str,L"chain_0",L"displace",L"-1.57");
IniWrite(str,L"chain_0",L"length",L"90.00");
IniWrite(str,L"chain_0",L"width",L"10.00");
IniWrite(str,L"chain_0",L"initangle",L"0.00 0.00");
IniWrite(str,L"chain_0",L"angle_restrict_phi",L"-3.14 3.14");
IniWrite(str,L"chain_0",L"angle_restrict_theta",L"-3.14 3.14");
IniWrite(str,L"chain_0",L"parent_index",L"-1");
IniWrite(str,L"chain_0",L"model",L"");
IniWrite(str,L"chain_0",L"offset",L"0 0 0");
IniWrite(str,L"chain_0",L"mass",L"100.00");
IniWrite(str,L"chain_0",L"tilt",L"0");
IniWrite(str,L"chain_0",L"pressure",L"0");
IniWrite(str,L"chain_0",L"laser",L"0");
manipulator->Release();
manipulator->Create(DXUTGetD3D9Device(), str);
MessageBox(0,L"Создана новая конфигурация манипулятора",L"",0);
OnChainSelect(-1);
break;
case IDC_LOADFILE_BTN:
manipulator->Release();
swprintf(str,L"./%s",g_HUD.GetEditBox( IDC_LOADFILE )->GetText());
manipulator->Create(DXUTGetD3D9Device(), str);
MessageBox(0,L"Манипулятор загружен из файла",L"",0);
OnChainSelect(-1);
break;
//dialog menu
case IDC_ADDCHAIN:
manipulator->AddChain(DXUTGetD3D9Device());
break;
case IDC_REMOVECHAIN:
manipulator->RemoveChain();
break;
case IDC_WIDTH:
switch( nEvent )
{
case EVENT_EDITBOX_STRING:
{
float fWidth;
LPCWSTR text = (( CDXUTEditBox* )pControl )->GetText();
swscanf(text, L"%f", &fWidth);
g_SampleUI.GetSlider(IDC_WIDTH_SLIDER)->SetValue(fWidth);
manipulator->cube[manipulator->selectedChain]->SetWidth(fWidth);
break;
}
}
break;
case IDC_WIDTH_SLIDER:
val = (float)( ( CDXUTSlider* )pControl )->GetValue();
manipulator->cube[manipulator->selectedChain]->SetWidth(val);
//.........这里部分代码省略.........
示例3: OnChainSelect
//------------------------------------------------------------------------
// Name: OnChainSelect
// Desc: event handler for select one of chains
//------------------------------------------------------------------------
HRESULT OnChainSelect(int iID)
{
if(iID >= 0)
{
wchar_t str[256];
cprimitive* chain = manipulator->cube[iID];
g_SampleUI.SetVisible(true);
swprintf(str,L"You picked chain # %d",iID);
g_SampleUI.GetStatic( IDC_OBJNAME )->SetText(str);
g_SampleUI.GetSlider(IDC_WIDTH_SLIDER)->SetValue(chain->fWidth);
swprintf(str,L"%.2f",chain->fWidth);
g_SampleUI.GetEditBox( IDC_WIDTH )->SetText(str);
g_SampleUI.GetSlider(IDC_LENGTH_SLIDER)->SetValue(chain->fLength);
swprintf(str,L"%.2f",chain->fLength);
g_SampleUI.GetEditBox( IDC_LENGTH )->SetText(str);
swprintf(str,L"%.2f",chain->restrictAngleX.x);
g_SampleUI.GetEditBox( IDC_ANGLE_RESTRICT_XL )->SetText(str);
swprintf(str,L"%.2f",chain->restrictAngleX.y);
g_SampleUI.GetEditBox( IDC_ANGLE_RESTRICT_XU )->SetText(str);
swprintf(str,L"%.2f",chain->restrictAngleY.x);
g_SampleUI.GetEditBox( IDC_ANGLE_RESTRICT_YL )->SetText(str);
swprintf(str,L"%.2f",chain->restrictAngleY.y);
g_SampleUI.GetEditBox( IDC_ANGLE_RESTRICT_YU )->SetText(str);
swprintf(str,L"%.2f",chain->vOffset.x);
g_SampleUI.GetEditBox( IDC_OFFSET_X )->SetText(str);
swprintf(str,L"%.2f",chain->vOffset.y);
g_SampleUI.GetEditBox( IDC_OFFSET_Y )->SetText(str);
swprintf(str,L"%.2f",chain->vOffset.z);
g_SampleUI.GetEditBox( IDC_OFFSET_Z )->SetText(str);
swprintf(str,L"%.2f",chain->fDisplace);
g_SampleUI.GetEditBox( IDC_DISPLACE )->SetText(str);
swprintf(str,L"%.2f",chain->fDirection);
g_SampleUI.GetEditBox( IDC_DIRECTION )->SetText(str);
swprintf(str,L"%.2f",chain->fCoefficient);
g_SampleUI.GetEditBox( IDC_COEFFICIENT )->SetText(str);
swprintf(str,L"%.2f",chain->fMass);
g_SampleUI.GetEditBox( IDC_MASS )->SetText(str);
g_SampleUI.GetCheckBox( IDC_TILT )->SetChecked(chain->bTilt);
g_SampleUI.GetCheckBox( IDC_PRESSURE )->SetChecked(chain->bPressure);
g_SampleUI.GetCheckBox( IDC_LASER )->SetChecked(chain->bLaser);
swprintf(str,L"X: %.2f",chain->vAngle.x);
g_SampleUI.GetStatic( IDC_STATIC7 )->SetText(str);
swprintf(str,L"Y: %.2f",chain->vAngle.y);
g_SampleUI.GetStatic( IDC_STATIC8 )->SetText(str);
}
else
{
g_SampleUI.SetVisible(false);
}
return S_OK;
}