本文整理汇总了C++中AttributeIterator::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ AttributeIterator::getNext方法的具体用法?C++ AttributeIterator::getNext怎么用?C++ AttributeIterator::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AttributeIterator
的用法示例。
在下文中一共展示了AttributeIterator::getNext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void HudScheduling::init( Ui::Menu_HUD* ui, AttributePtr<Attribute_Player> ptr_owner_player )
{
parent = ui->label_scheduling_background->parentWidget();
window = ui->label_scheduling_background;
subWindow = ui->label_scheduling_subbackground;
progressbar = ui->progressBar_scheduling_progressbar;
advantageLabel = ui->label_priority_advantage;
Float2 screenSize;
screenSize.x = window->parentWidget()->width();
screenSize.y = window->parentWidget()->height();
// Compute sizes
itemHeight = subWindow->height();
itemWidth = itemHeight*0.8f;
standardMargin = itemHeight * 0.5f;
int maxWindowSize = parent->width() - (ui->groupBox_health->width() + ui->groupBox_ammo->width() * 3.3f);
if(window->width() > maxWindowSize)
window->resize( maxWindowSize , window->height());
subWindow->resize(window->width() - 2*standardMargin, subWindow->height());
progressbar->resize(window->width() - 2*standardMargin, progressbar->height());
int windowHeight = standardMargin*2 + itemHeight + subWindow->height() + progressbar->height();
window->resize(window->width(), windowHeight);
advantageLabel->resize(itemWidth, advantageLabel->height());
// Compute positions
window->move(screenSize.x*0.5f - window->width()*0.5, screenSize.y - window->height() - 9);
progressbar->move(window->x() + standardMargin, window->y() + standardMargin);
subWindow->move(window->x() + standardMargin, progressbar->y() + progressbar->height() + standardMargin);
advantageLabel->move(subWindow->x(), subWindow->y());
//hide();
ui->label_7->hide();
ui->label_8->hide();
//ui->label_priority_advantage->hide();
progressbar->setMaximum(500);
// Add players
AttributeIterator<Attribute_Player> itrPlayer = ATTRIBUTE_MANAGER->player.getIterator();
while(itrPlayer.hasNext())
{
AttributePtr<Attribute_Player> ptr_player = itrPlayer.getNext();
//ptr_player->priority = 5;
QLabel* l = new QLabel(parent);
l->resize(itemWidth, standardMargin);
l->move(subWindow->x() + 0.5f, subWindow->y() + 0.5f);
// Set color based on player's color
Float3 color = ptr_player->avatarColor;
std::string str_backgroundColor = "rgba("+Converter::IntToStr((int)(color.x * 255))+", "+Converter::IntToStr((int)(color.y * 255))+", "+ Converter::IntToStr((int)(color.z * 255)) +", 200);";
std::string str_borderColor = "rgba("+Converter::IntToStr((int)(color.x * 255))+", "+Converter::IntToStr((int)(color.y * 255))+", "+ Converter::IntToStr((int)(color.z * 255)) +", 255);";
std::string str_sheet = "background: " + str_backgroundColor + "border: 1px solid rgba(0, 0, 0, 30); border-top: 2px solid rgba(255, 255, 255, 30); border-right: 2px solid rgba(255, 255, 255, 30);";
l->setStyleSheet(QString(str_sheet.c_str()));
l->show();
// Save ref to owner player
if(ptr_player == ptr_owner_player)
ownerIndex = items.size();
// Create item
HudScheduling_Item item;
item.label = l;
item.ptr_player = ptr_player;
item.setPosition(Float2(subWindow->x(), subWindow->y()));
items.push_back(item);
}
// Show advantage label on top
advantageLabel->raise();
}