本文整理汇总了C++中ListWidget::getSelectionLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ ListWidget::getSelectionLabel方法的具体用法?C++ ListWidget::getSelectionLabel怎么用?C++ ListWidget::getSelectionLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListWidget
的用法示例。
在下文中一共展示了ListWidget::getSelectionLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eventCallback
void StoryModeLobbyScreen::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "creategame")
{
new EnterPlayerNameDialog(this, 0.5f, 0.4f);
}
else if (name == "gameslots")
{
ListWidget* list = getWidget<ListWidget>("gameslots");
bool slot_found = false;
PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
for (int n=0; n<players.size(); n++)
{
if (list->getSelectionLabel() == players[n].getName())
{
unlock_manager->setCurrentSlot(players[n].getUniqueID());
unlock_manager->updateActiveChallengeList();
slot_found = true;
break;
}
}
if (!slot_found)
{
fprintf(stderr, "[StoryModeLobbyScreen] ERROR: cannot find player corresponding to slot '%s'\n",
core::stringc(list->getSelectionLabel().c_str()).c_str());
}
else
{
CheckBoxWidget* cb = getWidget<CheckBoxWidget>("rememberme");
if (cb->getState())
{
UserConfigParams::m_default_player = list->getSelectionLabel();
}
}
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
}
} // eventCallback
示例2: eventCallback
void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "addplayer")
{
new EnterPlayerNameDialog(this, 0.5f, 0.4f);
}
else if (name == "players")
{
// Find which player in the list was clicked
ListWidget* players = this->getWidget<ListWidget>("players");
assert(players != NULL);
core::stringw selectedPlayer = players->getSelectionLabel();
const int player_amount = PlayerManager::get()->getNumPlayers();
for (int i=0; i<player_amount; i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if (selectedPlayer == translations->fribidize(player->getName()))
{
if (!(player->isGuestAccount()))
{
new PlayerInfoDialog( player, 0.5f, 0.6f );
}
return;
}
} // end for
}
else if (name == "playername")
{
race_manager->clearKartLastPositionOnOverworld();
PlayerManager::get()->setCurrentPlayer(NULL,false);
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
}
} // eventCallback