本文整理汇总了C++中SpinnerWidget::setMax方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinnerWidget::setMax方法的具体用法?C++ SpinnerWidget::setMax怎么用?C++ SpinnerWidget::setMax使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinnerWidget
的用法示例。
在下文中一共展示了SpinnerWidget::setMax方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ModalDialog
StoryModeNewDialog::StoryModeNewDialog(const float w, const float h) :
ModalDialog(w, h)
{
loadFromFile("story_mode_new.stkgui");
SpinnerWidget* ident = getWidget<SpinnerWidget>("identity");
const int playerAmount = UserConfigParams::m_all_players.size();
ident->setMax(playerAmount - 1);
for(int n=0; n<playerAmount; n++)
{
ident->addLabel( translations->fribidize(UserConfigParams::m_all_players[n].getName()) );
}
RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty");
difficulty->setSelection( 1 /* medium */, PLAYER_ID_GAME_MASTER );
ident->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
示例2: init
void RaceSetupScreen::init()
{
Screen::init();
RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
assert( w != NULL );
w->setSelection( UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER );
SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
kartamount->setActivated();
// Avoid negative numbers (which can happen if e.g. the number of karts
// in a previous race was lower than the number of players now.
int num_ai = race_manager->getNumberOfKarts()-race_manager->getNumLocalPlayers();
if(num_ai<0) num_ai = 0;
kartamount->setValue(num_ai);
kartamount->setMax(stk_config->m_max_karts - race_manager->getNumLocalPlayers() );
DynamicRibbonWidget* w2 = getWidget<DynamicRibbonWidget>("gamemode");
assert( w2 != NULL );
w2->clearItems();
// ---- Add game modes
irr::core::stringw name1 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_NORMAL_RACE)) + L"\n";
//FIXME: avoid duplicating descriptions from the help menu!
name1 += _("All blows allowed, so catch weapons and make clever use of them!");
w2->addItem( name1, IDENT_STD, RaceManager::getIconOf(RaceManager::MINOR_MODE_NORMAL_RACE));
irr::core::stringw name2 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_TIME_TRIAL)) + L"\n";
//FIXME: avoid duplicating descriptions from the help menu!
name2 += _("Contains no powerups, so only your driving skills matter!");
w2->addItem( name2, IDENT_TTRIAL, RaceManager::getIconOf(RaceManager::MINOR_MODE_TIME_TRIAL));
if (unlock_manager->getCurrentSlot()->isLocked(IDENT_FTL))
{
w2->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), true);
}
else
{
irr::core::stringw name3 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_FOLLOW_LEADER)) + L"\n";
//I18N: short definition for follow-the-leader game mode
name3 += _("Keep up with the leader kart but don't overtake it!");
w2->addItem(name3, IDENT_FTL, RaceManager::getIconOf(RaceManager::MINOR_MODE_FOLLOW_LEADER), false);
}
if (race_manager->getNumLocalPlayers() > 1 || UserConfigParams::m_artist_debug_mode)
{
irr::core::stringw name4 = irr::core::stringw(
RaceManager::getNameOf(RaceManager::MINOR_MODE_3_STRIKES)) + L"\n";
//FIXME: avoid duplicating descriptions from the help menu!
name4 += _("Hit others with weapons until they lose all their lives. (Only in multiplayer games)");
w2->addItem( name4, IDENT_STRIKES, RaceManager::getIconOf(RaceManager::MINOR_MODE_3_STRIKES));
}
w2->updateItemDisplay();
// restore saved game mode
switch (UserConfigParams::m_game_mode)
{
case CONFIG_CODE_NORMAL :
w2->setSelection(IDENT_STD, PLAYER_ID_GAME_MASTER, true);
break;
case CONFIG_CODE_TIMETRIAL :
w2->setSelection(IDENT_TTRIAL, PLAYER_ID_GAME_MASTER, true);
break;
case CONFIG_CODE_FTL :
w2->setSelection(IDENT_FTL, PLAYER_ID_GAME_MASTER, true);
break;
case CONFIG_CODE_3STRIKES :
w2->setSelection(IDENT_STRIKES, PLAYER_ID_GAME_MASTER, true);
break;
}
m_mode_listener = new GameModeRibbonListener(this);
w2->registerHoverListener(m_mode_listener);
}