本文整理汇总了C++中UIWindow::setDimension方法的典型用法代码示例。如果您正苦于以下问题:C++ UIWindow::setDimension方法的具体用法?C++ UIWindow::setDimension怎么用?C++ UIWindow::setDimension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow::setDimension方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buildWindowVB
void UIDisplay::buildWindowVB( UIWindow& window, float aspectRatio )
{
//Build window border
buildBorderVB( &window, aspectRatio );
if( window.getTabCount() > 1 ) {
//Buil Tabs after subtracting the title bar and border
buildTabVB( window, aspectRatio );
} else {
//Calculate the inside of a window
UIWindow w;
float borderWidth = mBorderDimension;
float borderHeight = borderWidth * aspectRatio;
w.setPosition( XMFLOAT2(window.getPosition().x + borderWidth, (window.getPosition().y + UIWINDOW_TITLE_BAR_HEIGHT) ) );
w.setDimension( XMFLOAT2(window.getDimension().x - ( borderWidth * 2.0f ), (window.getDimension().y - UIWINDOW_TITLE_BAR_HEIGHT ) - borderHeight ) );
buildBorderVB( &w, aspectRatio );
}
//Build BG
buildBGVB( &window, mBGColor );
UIWindow::Tab& t = window.getTab( window.getCurrentTab() );
mBuildingElements = true;
//Loop through and build elements in the current tab
for(int i = 0; i < t.elementCount; i++) {
buildBorderVB( t.elements[i], aspectRatio, window.getPosition() );
if( t.elements[i]->getElemType() == UIElement::ElemType::Slider ) {
UISlider* slider = *(UISlider**)(t.elements + i);
UIWindow w;
w.setPosition( XMFLOAT2( slider->getPosition().x + window.getPosition().x, slider->getPosition().y + window.getPosition().y ) );
w.setDimension( XMFLOAT2( slider->getDimension().x * slider->getPercent(), slider->getDimension().y ) );
XMFLOAT4 pctColor = XMFLOAT4( 1.0f, 0.0f, 0.0f, 0.3f );
buildBGVB( &w, pctColor );
} else if( t.elements[i]->getElemType() == UIElement::ElemType::CheckBox ) {
UICheckbox* cb = *(UICheckbox**)(t.elements + i);
if( cb->isChecked() ) {
UICheckbox b;
b.setPosition( XMFLOAT2( cb->getPosition().x + window.getPosition().x, cb->getPosition().y + window.getPosition().y ) );
b.setDimension( XMFLOAT2( cb->getDimension().x, cb->getDimension().y ) );
buildCheckboxVB( &b );
}
}
}
mBuildingElements = false;
}