本文整理汇总了C++中IconButtonWidget::add方法的典型用法代码示例。如果您正苦于以下问题:C++ IconButtonWidget::add方法的具体用法?C++ IconButtonWidget::add怎么用?C++ IconButtonWidget::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IconButtonWidget
的用法示例。
在下文中一共展示了IconButtonWidget::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModalDialog
TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::string& trackIdent,
const irr::core::stringw& trackName, ITexture* screenshot,
const float w, const float h) : ModalDialog(w, h)
{
loadFromFile("track_info_dialog.stkgui");
const bool has_laps = race_manager->modeHasLaps();
const bool has_highscores = race_manager->modeHasHighscores();
m_track_ident = trackIdent;
m_ribbon_item = ribbonItem;
getWidget<LabelWidget>("name")->setText(trackName.c_str(), false);
Track* track = track_manager->getTrack(trackIdent);
//I18N: when showing who is the author of track '%s' (place %s where the name of the author should appear)
getWidget<LabelWidget>("author")->setText( _("Track by %s", track->getDesigner().c_str()), false );
// ---- Track screenshot
Widget* screenshot_div = getWidget("screenshot_div");
IconButtonWidget* screenshotWidget = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO,
false /* tab stop */, false /* focusable */);
// images are saved squared, but must be stretched to 4:
screenshotWidget->setCustomAspectRatio(4.0f / 3.0f);
screenshotWidget->m_x = screenshot_div->m_x;
screenshotWidget->m_y = screenshot_div->m_y;
screenshotWidget->m_w = screenshot_div->m_w;
screenshotWidget->m_h = screenshot_div->m_h;
// temporary icon, will replace it just after (but it will be shown if the given icon is not found)
screenshotWidget->m_properties[PROP_ICON] = "gui/main_help.png";
screenshotWidget->setParent(m_irrlicht_window);
screenshotWidget->add();
if (screenshot != NULL)
{
screenshotWidget->setImage(screenshot);
}
m_widgets.push_back(screenshotWidget);
// ---- Lap count m_spinner
if (has_laps)
{
m_spinner = getWidget<SpinnerWidget>("lapcountspinner");
m_spinner->m_properties[PROP_ID] = "lapcountspinner";
if (UserConfigParams::m_artist_debug_mode)
{
m_spinner->setMin(0);
}
//I18N: In the track setup screen (number of laps choice, where %i is the number)
//m_spinner->setText( _("%i laps") );
m_spinner->setValue( UserConfigParams::m_num_laps );
//m_spinner->getIrrlichtElement()->setTabStop(true);
//m_spinner->getIrrlichtElement()->setTabGroup(false);
const int num_laps = m_spinner->getValue();
race_manager->setNumLaps(num_laps);
}
else
{
getWidget<SpinnerWidget>("lapcountspinner")->setVisible(false);
m_spinner = NULL;
}
// Reverse track
const bool reverse_available = track->reverseAvailable() &&
race_manager->getMinorMode() != RaceManager::MINOR_MODE_EASTER_EGG;
if (reverse_available)
{
m_checkbox = getWidget<CheckBoxWidget>("reverse");
m_checkbox->setState(race_manager->getReverseTrack());
}
else
{
getWidget<CheckBoxWidget>("reverse")->setVisible(false);
getWidget<LabelWidget>("reverse-text")->setVisible(false);
m_checkbox = NULL;
race_manager->setReverseTrack(false);
}
// ---- High Scores
if (has_highscores)
{
m_kart_icons[0] = getWidget<IconButtonWidget>("iconscore1");
m_kart_icons[1] = getWidget<IconButtonWidget>("iconscore2");
m_kart_icons[2] = getWidget<IconButtonWidget>("iconscore3");
m_highscore_entries[0] = getWidget<LabelWidget>("highscore1");
m_highscore_entries[1] = getWidget<LabelWidget>("highscore2");
m_highscore_entries[2] = getWidget<LabelWidget>("highscore3");
updateHighScores();
}
//.........这里部分代码省略.........