本文整理汇总了C++中IconButtonWidget::setImage方法的典型用法代码示例。如果您正苦于以下问题:C++ IconButtonWidget::setImage方法的具体用法?C++ IconButtonWidget::setImage怎么用?C++ IconButtonWidget::setImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IconButtonWidget
的用法示例。
在下文中一共展示了IconButtonWidget::setImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
SelectChallengeDialog::SelectChallengeDialog(const float percentWidth,
const float percentHeight,
std::string challenge_id) :
ModalDialog(percentWidth, percentHeight)
{
loadFromFile("select_challenge.stkgui");
m_challenge_id = challenge_id;
World::getWorld()->schedulePause(WorldStatus::IN_GAME_MENU_PHASE);
switch (UserConfigParams::m_difficulty)
{
case 0:
getWidget("novice")->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
break;
case 1:
getWidget("intermediate")->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
break;
case 2:
getWidget("expert")->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
break;
}
const ChallengeStatus* c = PlayerManager::getCurrentPlayer()
->getChallengeStatus(challenge_id);
if (c->isSolved(RaceManager::DIFFICULTY_EASY))
{
IconButtonWidget* btn = getWidget<IconButtonWidget>("novice");
btn->setImage(file_manager->getAsset(FileManager::GUI, "cup_bronze.png"),
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
if (c->isSolved(RaceManager::DIFFICULTY_MEDIUM))
{
IconButtonWidget* btn = getWidget<IconButtonWidget>("intermediate");
btn->setImage(file_manager->getAsset(FileManager::GUI,"cup_silver.png"),
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
if (c->isSolved(RaceManager::DIFFICULTY_HARD))
{
IconButtonWidget* btn = getWidget<IconButtonWidget>("expert");
btn->setImage(file_manager->getAsset(FileManager::GUI,"cup_gold.png"),
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
LabelWidget* novice_label = getWidget<LabelWidget>("novice_label");
LabelWidget* medium_label = getWidget<LabelWidget>("intermediate_label");
LabelWidget* expert_label = getWidget<LabelWidget>("difficult_label");
novice_label->setText( getLabel(RaceManager::DIFFICULTY_EASY, c->getData()), false );
medium_label->setText( getLabel(RaceManager::DIFFICULTY_MEDIUM, c->getData()), false );
expert_label->setText( getLabel(RaceManager::DIFFICULTY_HARD, c->getData()), false );
if (c->getData()->isGrandPrix())
{
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(c->getData()->getGPId());
getWidget<LabelWidget>("title")->setText( gp->getName(), true );
}
else
{
const wchar_t* track_name = track_manager->getTrack(c->getData()->getTrackId())->getName();
getWidget<LabelWidget>("title")->setText( track_name, true );
}
LabelWidget* typeLbl = getWidget<LabelWidget>("race_type_val");
if (c->getData()->isGrandPrix())
typeLbl->setText(_("Grand Prix"), false );
else if (c->getData()->getEnergy(RaceManager::DIFFICULTY_EASY) > 0)
typeLbl->setText(_("Nitro challenge"), false );
else
typeLbl->setText( RaceManager::getNameOf(c->getData()->getMinorMode()), false );
}
示例2: 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();
}
//.........这里部分代码省略.........