本文整理汇总了C++中UIWindow::getTabCount方法的典型用法代码示例。如果您正苦于以下问题:C++ UIWindow::getTabCount方法的具体用法?C++ UIWindow::getTabCount怎么用?C++ UIWindow::getTabCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIWindow
的用法示例。
在下文中一共展示了UIWindow::getTabCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: buildTabVB
void UIDisplay::buildTabVB( UIWindow& window, float aspectRatio )
{
float borderWidth = mBorderDimension;
float borderHeight = borderWidth * aspectRatio;
float l = window.getPosition().x + borderWidth;
float t = -window.getPosition().y - UIWINDOW_TITLE_BAR_HEIGHT;
float r = l + borderWidth;
float b = t - borderHeight;
//Top Left corner
buildCornerVB( l, t, aspectRatio );
//Build Top Left Bar
buildLeftBarVB( b, b - UIWINDOW_TITLE_BAR_HEIGHT + borderHeight, l, aspectRatio );
//Tab Borders
for(uint i = 0; i < window.getTabCount(); i++) {
float len = static_cast<float>(strlen(window.getTab(i).name)) * FONTWIDTH;
float saveCorner = l;
//Move over our box
l = r;
r = r + len;
//Top Bar for tab
buildTopBarVB( l, r, t, aspectRatio );
l = r;
r += borderWidth;
//Top Right Corner for tab
buildCornerVB( l, t, aspectRatio );
b = t - UIWINDOW_TITLE_BAR_HEIGHT;
//Right bar for tab
buildRightBarVB( t, b, l, aspectRatio );
//Draw the top bars on either side of the current tab
if( i == window.getCurrentTab() ) {
//Left Top Bar
buildTopBarVB( window.getPosition().x + ( borderWidth * 2.0f ), saveCorner, b, aspectRatio );
buildCornerVB( saveCorner, b, aspectRatio );
//Right top bar
buildTopBarVB( r, window.getPosition().x + window.getDimension().x - (borderWidth * 2.0f), b, aspectRatio );
buildCornerVB( l, b, aspectRatio );
}
}
l = window.getPosition().x + window.getDimension().x - ( borderWidth * 2.0f );
r = l + borderWidth;
//buildTopBarVB( l, r, b, aspectRatio );
//Top Right Corner
//l = r;
//r += borderWidth;
buildCornerVB( l, b, aspectRatio );
//RB
t = b;
b = (-window.getPosition().y - window.getDimension().y) + (borderHeight * 2.0f);
buildRightBarVB( t, b, l, aspectRatio );
//BRC
t = b;
b -= borderHeight;
buildCornerVB( l, t, aspectRatio );
//BB
l = window.getPosition().x + ( borderWidth * 2.0f );
r = (window.getPosition().x + window.getDimension().x) - (borderWidth * 2.0f);
buildBottomBarVB( l, r, t, aspectRatio );
//BLC
l = window.getPosition().x + borderWidth;
r = l + borderWidth;
buildCornerVB( l, t, aspectRatio );
//LB
t = -window.getPosition().y - ( UIWINDOW_TITLE_BAR_HEIGHT * 2.0f) - borderHeight;
b = (-window.getPosition().y - window.getDimension().y) + borderHeight;
buildLeftBarVB( t, b, l, aspectRatio );
t += borderHeight;
//Top Left Corner
buildCornerVB( l, t, aspectRatio );
}
示例3: drawWindowText
void UIDisplay::drawWindowText( ID3D11DeviceContext* device, UIWindow& window, TextManager& tm )
{
UIWindow::Text* text;
uint textCount;
window.getText( &text, &textCount );
float x = 0.0f;
float y = 0.0f;
float len = static_cast<float>( strlen( text->message ) ) * FONTWIDTH;
y = window.getPosition().y + (UIWINDOW_TITLE_BAR_HEIGHT / 2.0f) - ( FONTHEIGHT / 2.0f );
x = window.getPosition().x + ( window.getDimension().x / 2.0f ) - ( len / 2.0f );
XMFLOAT4 colors[3] =
{
XMFLOAT4(1,1,1,1), //Not selected: White
XMFLOAT4(1,1,0,1), //Highlighted: Yellow
XMFLOAT4(0,0,1,1) //Selected: Blue
};
D3DX11_TECHNIQUE_DESC techDesc;
mTechnique->GetDesc( &techDesc );
for(ushort p = 0; p < techDesc.Passes; ++p)
{
//Draw title
mTechnique->GetPassByIndex(p)->Apply(0, device);
tm.drawString( device, text->message, x, y );
float len = 0.0f;
//Draw tab names
for(uint i = 0; i < window.getTabCount(); i++) {
tm.drawString( device, window.getTab(i).name,
window.getPosition().x +(mBorderDimension * 2.0f) + len,
window.getPosition().y + (UIWINDOW_TITLE_BAR_HEIGHT * 2.0f) - ( FONTHEIGHT * 1.5f ),
i == window.getCurrentTab() ? colors[2] : window.getTab(i).highlighted ? colors[1] : colors[0]);
len += static_cast<float>(strlen(window.getTab(i).name)) * FONTWIDTH + ( FONTWIDTH / 2.0f );
}
//Draw UI Text
UIWindow::Tab& t = window.getTab( window.getCurrentTab() );
//Loop through and build elements in the current tab
for(int i = 0; i < t.elementCount; i++) {
if( t.elements[i]->getElemType() == UIElement::ElemType::TextBox ) {
UIElement::Text* text;
uint textCount;
t.elements[i]->getText( &text, &textCount );
for(uint l = 0; l < textCount; l++) {
tm.drawString( device, text[l].message,
t.elements[i]->getPosition().x + text[l].offset.x + window.getPosition().x + FONTWIDTH / 2.0f,
t.elements[i]->getPosition().y + text[l].offset.y + window.getPosition().y + (FONTHEIGHT / 2.0f),
colors[0] );
}
} else if( t.elements[i]->getElemType() == UIElement::ElemType::OptionBox ) {
UIOptionBox* box = (UIOptionBox*)(t.elements[i]);
for(uint o = 0; o < box->getNumOptions(); o++) {
char* opt = box->getOption(o);
uint optIndex = o + ( box->getScrollIndex() - box->getNumOptions() );
tm.drawString( device, opt,
t.elements[i]->getPosition().x + window.getPosition().x + 0.02f,
t.elements[i]->getPosition().y + window.getPosition().y + ( ( FONTHEIGHT + 0.04f ) * static_cast<float>(o) ),
colors[ optIndex == box->getSelected() ? 2 : optIndex == box->getHighlighted() ? 1 : 0 ] );
}
} else {
UIElement::Text* text;
uint tCount;
t.elements[i]->getText(&text, &tCount );
//Center the text
float xOffset = (t.elements[i]->getDimension().x / 2.0f) - (static_cast<float>(strlen(text->message)) * FONTWIDTH / 2.0f);
float yOffset = (t.elements[i]->getDimension().y / 2.0f) - FONTHEIGHT / 2.0f;
//Draw the text bro
tm.drawString( device, text->message,
t.elements[i]->getPosition().x + window.getPosition().x + xOffset + text->offset.x,
t.elements[i]->getPosition().y + window.getPosition().y + yOffset + text->offset.y,
colors[ t.elements[i]->getSelectedState() ]);
}
//If it is a drop menu, draw the options
if( t.elements[i]->getElemType() == UIElement::ElemType::DropMenu ) {
UIDropMenu* d = *(UIDropMenu**)(t.elements + i);
float tx = t.elements[i]->getPosition().x + window.getPosition().x + (FONTWIDTH / 2.0f);
float ty = t.elements[i]->getPosition().y + window.getPosition().y + (FONTHEIGHT / 2.0f);
if( d->isDropped() ) {
for(uint o = 0; o < d->getOptionCount(); o++) {
tm.drawString( device, d->getOption(o),
tx, ty,
d->getSelectedOption() == o ? colors[2] : d->getHightlightedOption() == o ? colors[1] : colors[0] );
//.........这里部分代码省略.........