本文整理汇总了C++中LabelWidget::add方法的典型用法代码示例。如果您正苦于以下问题:C++ LabelWidget::add方法的具体用法?C++ LabelWidget::add怎么用?C++ LabelWidget::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LabelWidget
的用法示例。
在下文中一共展示了LabelWidget::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModalDialog
GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const float h) : ModalDialog(w, h)
{
doInit();
m_curr_time = 0.0f;
const int y1 = m_area.getHeight()/7;
const int y2 = m_area.getHeight()*6/7;
m_gp_ident = gpIdent;
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent);
if (gp == NULL)
{
assert(false);
std::cerr << "ERROR at " << __FILE__ << " : " << __LINE__ << "; trying to continue\n";
ModalDialog::dismiss();
return;
}
// ---- GP Name
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
IGUIStaticText* title = GUIEngine::getGUIEnv()->addStaticText( translations->fribidize(gp->getName()),
area_top, false, true, // border, word wrap
m_irrlicht_window);
title->setTabStop(false);
title->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
// ---- Track listings
const std::vector<std::string>& tracks = gp->getTrackNames();
const int trackAmount = tracks.size();
int height_of_one_line = (y2 - y1)/(trackAmount+1);
const int textHeight = GUIEngine::getFontHeight();
if (height_of_one_line > (int)(textHeight*1.5f)) height_of_one_line = (int)(textHeight*1.5f);
bool gp_ok = true;
for (int t=0; t<trackAmount; t++)
{
const int from_y = y1 + height_of_one_line*(t+1);
Track* track = track_manager->getTrack(tracks[t]);
stringw lineText;
if (track == NULL)
{
lineText = L"MISSING : ";
lineText.append( stringw(tracks[t].c_str()) );
gp_ok = false;
}
else
{
lineText = track->getName();
}
LabelWidget* widget = new LabelWidget();
widget->setText(translations->fribidize(lineText), false);
widget->m_x = 20;
widget->m_y = from_y;
widget->m_w = m_area.getWidth()/2 - 20;
widget->m_h = height_of_one_line;
widget->setParent(m_irrlicht_window);
m_widgets.push_back(widget);
widget->add();
// IGUIStaticText* line = GUIEngine::getGUIEnv()->addStaticText( lineText.c_str(),
// entry_area, false , true , // border, word wrap
// m_irrlicht_window);
}
// ---- Track screenshot
m_screenshot_widget = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO,
false /* tab stop */, false /* focusable */,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE /* Track gives us absolute paths */);
// images are saved squared, but must be stretched to 4:3
m_screenshot_widget->setCustomAspectRatio(4.0f / 3.0f);
m_screenshot_widget->m_x = m_area.getWidth()/2;
m_screenshot_widget->m_y = y1;
m_screenshot_widget->m_w = m_area.getWidth()/2;
m_screenshot_widget->m_h = y2 - y1 - 10;
Track* track = track_manager->getTrack(tracks[0]);
m_screenshot_widget->m_properties[PROP_ICON] = (track != NULL ?
track->getScreenshotFile().c_str() :
file_manager->getAsset(FileManager::GUI,"main_help.png"));
m_screenshot_widget->setParent(m_irrlicht_window);
m_screenshot_widget->add();
m_widgets.push_back(m_screenshot_widget);
// ---- Start button
ButtonWidget* okBtn = new ButtonWidget();
ButtonWidget* continueBtn = new ButtonWidget();
SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()
->getActivePlayerProfile(0)
//.........这里部分代码省略.........