本文整理汇总了C++中DynamicRibbonWidget::updateItemDisplay方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicRibbonWidget::updateItemDisplay方法的具体用法?C++ DynamicRibbonWidget::updateItemDisplay怎么用?C++ DynamicRibbonWidget::updateItemDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicRibbonWidget
的用法示例。
在下文中一共展示了DynamicRibbonWidget::updateItemDisplay方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renumberKarts
void KartSelectionScreen::renumberKarts()
{
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert( w != NULL );
Widget* fullarea = getWidget("playerskarts");
int splitWidth = fullarea->m_w / m_kart_widgets.size();
if (m_kart_widgets.size() == 1)
splitWidth /= 2;
for (unsigned int n=0; n < m_kart_widgets.size(); n++)
{
m_kart_widgets[n].setPlayerID(n);
m_kart_widgets[n].move( fullarea->m_x + splitWidth*n, fullarea->m_y,
splitWidth, fullarea->m_h );
}
w->updateItemDisplay();
} // renumberKarts
示例2: buildTrackList
//.........这里部分代码省略.........
if(!curr->isSoccer() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isSoccer())
m_unsupported_arena.insert(n);
continue;
}
}
else
{
if(curr->isArena() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isArena() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isArena())
m_unsupported_arena.insert(n);
continue;
}
}
if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE );
}
else
{
w->addItem( translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
else
{
const std::vector<int>& currArenas = track_manager->getArenasInGroup(curr_group_name, soccer_mode);
const int track_amount = (int)currArenas.size();
for (int n=0; n<track_amount; n++)
{
Track* curr = track_manager->getTrack(currArenas[n]);
if (soccer_mode)
{
if(curr->isSoccer() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isSoccer() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isSoccer())
m_unsupported_arena.insert(currArenas[n]);
continue;
}
}
else
{
if(curr->isArena() && curr->hasNavMesh() && !arenas_have_navmesh)
arenas_have_navmesh = true;
if(!curr->isArena() ||
(!(curr->hasNavMesh() ||
race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)))
{
if (curr->isArena())
m_unsupported_arena.insert(currArenas[n]);
continue;
}
}
if (PlayerManager::getCurrentPlayer()->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE );
}
else
{
w->addItem( translations->fribidize(curr->getName()), curr->getIdent(), curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
if (arenas_have_navmesh || race_manager->getNumLocalPlayers() > 1 ||
UserConfigParams::m_artist_debug_mode)
w->addItem(_("Random Arena"), "random_track", "/gui/icons/track_random.png");
w->updateItemDisplay();
if (m_unsupported_arena.size() > 0)
w->setText( _P("%d arena unavailable in single player.",
"%d arenas unavailable in single player.",
(int)m_unsupported_arena.size()) );
}
示例3: init
void KartSelectionScreen::init()
{
m_instance_ptr = this;
Screen::init();
m_must_delete_on_back = false;
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
assert( tabs != NULL );
tabs->select(UserConfigParams::m_last_used_kart_group,
PLAYER_ID_GAME_MASTER);
Widget* placeholder = getWidget("playerskarts");
assert(placeholder != NULL);
// FIXME : The reserved id value is -1 when we switch from KSS to NKSS and vice-versa
m_dispatcher->setRootID(placeholder->m_reserved_id);
g_root_id = placeholder->m_reserved_id;
if (!m_widgets.contains(m_dispatcher))
{
m_widgets.push_back(m_dispatcher);
// this is only needed if the dispatcher wasn't already in
// the list of widgets. If it already was, it was added along
// other widgets.
m_dispatcher->add();
}
m_game_master_confirmed = false;
tabs->setActive(true);
m_kart_widgets.clearAndDeleteAll();
StateManager::get()->resetActivePlayers();
input_manager->getDeviceManager()->setAssignMode(DETECT_NEW);
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
assert( w != NULL );
KartHoverListener* karthoverListener = new KartHoverListener(this);
w->registerHoverListener(karthoverListener);
// Build kart list (it is built everytime, to account for .g. locking)
setKartsFromCurrentGroup();
/*
TODO: Ultimately, it'd be nice to *not* clear m_kart_widgets so that
when players return to the kart selection screen, it will appear as
it did when they left (at least when returning from the track menu).
Rebuilding the screen is a little tricky.
*/
/*
if (m_kart_widgets.size() > 0)
{
// trying to rebuild the screen
for (int n = 0; n < m_kart_widgets.size(); n++)
{
PlayerKartWidget *pkw;
pkw = m_kart_widgets.get(n);
manualAddWidget(pkw);
pkw->add();
}
}
else */
// For now this is what will happen
if (!m_multiplayer)
{
joinPlayer(input_manager->getDeviceManager()->getLatestUsedDevice());
w->updateItemDisplay();
// Player 0 select default kart
if (!w->setSelection(UserConfigParams::m_default_kart, 0, true))
{
// if kart from config not found, select the first instead
w->setSelection(0, 0, true);
}
} else
// Add multiplayer message
addMultiplayerMessage();
// This flag will cause that a 'fire' event will be mapped to 'select' (if
// 'fire' is not assigned to a GUI event). This is done to support the old
// way of player joining by pressing 'fire' instead of 'select'.
input_manager->getDeviceManager()->mapFireToSelect(true);
} // init
示例4: setKartsFromCurrentGroup
void KartSelectionScreen::setKartsFromCurrentGroup()
{
RibbonWidget* tabs = getWidget<RibbonWidget>("kartgroups");
assert(tabs != NULL);
std::string selected_kart_group =
tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
UserConfigParams::m_last_used_kart_group = selected_kart_group;
// This can happen if addons are removed so that also the previously
// selected kart group is removed. In this case, select the
// 'standard' group
if (selected_kart_group != ALL_KART_GROUPS_ID &&
!kart_properties_manager->getKartsInGroup(selected_kart_group).size())
{
selected_kart_group = DEFAULT_GROUP_NAME;
}
DynamicRibbonWidget* w = getWidget<DynamicRibbonWidget>("karts");
w->clearItems();
int usable_kart_count = 0;
PtrVector<const KartProperties, REF> karts;
for(unsigned int i=0; i<kart_properties_manager->getNumberOfKarts(); i++)
{
const KartProperties* prop = kart_properties_manager->getKartById(i);
// Ignore karts that are not in the selected group
if(selected_kart_group != ALL_KART_GROUPS_ID &&
!prop->isInGroup(selected_kart_group))
continue;
karts.push_back(prop);
}
karts.insertionSort();
for(unsigned int i=0; i<karts.size(); i++)
{
const KartProperties* prop = karts.get(i);
if (PlayerManager::getCurrentPlayer()->isLocked(prop->getIdent()) &&
!m_multiplayer)
{
w->addItem(_("Locked : solve active challenges to gain access to more!"),
ID_LOCKED + prop->getIdent(),
prop->getAbsoluteIconFile(), LOCKED_BADGE,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
}
else
{
w->addItem(translations->fribidize(prop->getName()),
prop->getIdent(),
prop->getAbsoluteIconFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE);
usable_kart_count++;
}
}
// add random
if (usable_kart_count > 1)
{
w->addItem(_("Random Kart"), RANDOM_KART_ID, "/gui/random_kart.png");
}
w->updateItemDisplay();
}
示例5: buildTrackList
void ArenasScreen::buildTrackList()
{
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("tracks");
assert( w != NULL );
// Re-build track list everytime (accounts for locking changes, etc.)
w->clearItems();
RibbonWidget* tabs = this->getWidget<RibbonWidget>("trackgroups");
assert( tabs != NULL );
const std::string curr_group_name = tabs->getSelectionIDString(0);
bool soccer_mode = race_manager->getMinorMode() == RaceManager::MINOR_MODE_SOCCER;
if (curr_group_name == ALL_ARENA_GROUPS_ID)
{
const int trackAmount = track_manager->getNumberOfTracks();
for (int n=0; n<trackAmount; n++)
{
Track* curr = track_manager->getTrack(n);
if (soccer_mode)
{
if(!curr->isSoccer()) continue;
}
else
{
if(!curr->isArena()) continue;
}
if (PlayerManager::get()->getCurrentPlayer()->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE );
}
else
{
w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
else
{
const std::vector<int>& currArenas = track_manager->getArenasInGroup(curr_group_name, soccer_mode);
const int trackAmount = currArenas.size();
for (int n=0; n<trackAmount; n++)
{
Track* curr = track_manager->getTrack(currArenas[n]);
if (soccer_mode)
{
if(!curr->isSoccer()) continue;
}
else
{
if(!curr->isArena()) continue;
}
if (PlayerManager::get()->getCurrentPlayer()->isLocked(curr->getIdent()))
{
w->addItem( _("Locked : solve active challenges to gain access to more!"),
"locked", curr->getScreenshotFile(), LOCKED_BADGE );
}
else
{
w->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(), 0,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
w->addItem(_("Random Arena"), "random_track", "/gui/track_random.png");
w->updateItemDisplay();
assert(w->getItems().size() > 0);
}
示例6: init
//.........这里部分代码省略.........
r.height = modes[n].getHeight();
resolutions.push_back(r);
if (r.width == UserConfigParams::m_width &&
r.height == UserConfigParams::m_height)
{
found_config_res = true;
}
if (r.width == 1024 && r.height == 768)
{
found_1024_768 = true;
}
}
if (!found_config_res)
{
r.width = UserConfigParams::m_width;
r.height = UserConfigParams::m_height;
resolutions.push_back(r);
if (r.width == 1024 && r.height == 768)
{
found_1024_768 = true;
}
} // next found resolution
// Add default resolutions that were not found by irrlicht
if (!found_1024_768)
{
r.width = 1024;
r.height = 768;
resolutions.push_back(r);
}
// Sort resolutions by size
std::sort(resolutions.begin(), resolutions.end());
// Add resolutions list
for(std::vector<Resolution>::iterator it = resolutions.begin();
it != resolutions.end(); it++)
{
const float ratio = it->getRatio();
char name[32];
sprintf(name, "%ix%i", it->width, it->height);
core::stringw label;
label += it->width;
label += L"\u00D7";
label += it->height;
#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) ))
res->addItem(label, name, "/gui/screen54.png");
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) ))
res->addItem(label, name, "/gui/screen43.png");
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f)))
res->addItem(label, name, "/gui/screen1610.png");
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) ))
res->addItem(label, name, "/gui/screen53.png");
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) ))
res->addItem(label, name, "/gui/screen32.png");
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) ))
res->addItem(label, name, "/gui/screen169.png");
else
res->addItem(label, name, "/gui/screen_other.png");
#undef ABOUT_EQUAL
} // add next resolution
} // end if not inited
res->updateItemDisplay();
// ---- select current resolution every time
char searching_for[32];
snprintf(searching_for, 32, "%ix%i", (int)UserConfigParams::m_width,
(int)UserConfigParams::m_height);
if (!res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
false /* focus it */, true /* even if deactivated*/))
{
Log::error("OptionsScreenVideo", "Cannot find resolution %s", searching_for);
}
// --- set gfx settings values
updateGfxSlider();
// ---- forbid changing resolution or animation settings from in-game
// (we need to disable them last because some items can't be edited when
// disabled)
bool in_game = StateManager::get()->getGameState() == GUIEngine::INGAME_MENU;
res->setActive(!in_game);
full->setActive(!in_game);
applyBtn->setActive(!in_game);
gfx->setActive(!in_game);
getWidget<ButtonWidget>("custom")->setActive(!in_game);
} // init
示例7: init
//.........这里部分代码省略.........
const float ratio = (float)w / h;
if (w == 800 && h == 600)
{
#ifdef DEBUG
found_800_600 = true;
#endif
}
else if (w == 1024 && h == 640)
{
found_1024_640 = true;
}
else if (w == 1024 && h == 768)
{
found_1024_768 = true;
}
char name[32];
sprintf( name, "%ix%i", w, h );
core::stringw label;
label += w;
label += L"\u00D7";
label += h;
#define ABOUT_EQUAL(a , b) (fabsf( a - b ) < 0.01)
if (ABOUT_EQUAL( ratio, (5.0f/4.0f) ))
res->addItem(label, name, "/gui/screen54.png");
else if (ABOUT_EQUAL( ratio, (4.0f/3.0f) ))
res->addItem(label, name, "/gui/screen43.png");
else if (ABOUT_EQUAL( ratio, (16.0f/10.0f) ))
res->addItem(label, name, "/gui/screen1610.png");
else if (ABOUT_EQUAL( ratio, (5.0f/3.0f) ))
res->addItem(label, name, "/gui/screen53.png");
else if (ABOUT_EQUAL( ratio, (3.0f/2.0f) ))
res->addItem(label, name, "/gui/screen32.png");
else if (ABOUT_EQUAL( ratio, (16.0f/9.0f) ))
res->addItem(label, name, "/gui/screen169.png");
else
res->addItem(label, name, "/gui/screen_other.png");
#undef ABOUT_EQUAL
}
#ifdef DEBUG
if (!found_800_600)
{
res->addItem(L"800\u00D7600", "800x600", "/gui/screen43.png");
}
#endif
if (!found_1024_640)
{
res->addItem(L"1024\u00D7640", "1024x640", "/gui/screen1610.png");
}
if (!found_1024_768)
{
res->addItem(L"1024\u00D7768", "1024x768", "/gui/screen43.png");
}
} // end if not inited
res->updateItemDisplay();
// ---- select current resolution every time
char searching_for[32];
snprintf(searching_for, 32, "%ix%i", (int)UserConfigParams::m_width,
(int)UserConfigParams::m_height);
if (!res->setSelection(searching_for, PLAYER_ID_GAME_MASTER,
false /* focus it */, true /* even if deactivated*/))
{
Log::error("OptionsScreenVideo", "Cannot find resolution %s", searching_for);
}
// --- set gfx settings values
updateGfxSlider();
// ---- forbid changing resolution or animation settings from in-game
// (we need to disable them last because some items can't be edited when
// disabled)
if (StateManager::get()->getGameState() == GUIEngine::INGAME_MENU)
{
res->setDeactivated();
full->setDeactivated();
applyBtn->setDeactivated();
gfx->setDeactivated();
getWidget<ButtonWidget>("custom")->setDeactivated();
}
else
{
// Enable back widgets if they were visited in-game previously
res->setActivated();
full->setActivated();
applyBtn->setActivated();
gfx->setActivated();
getWidget<ButtonWidget>("custom")->setActivated();
}
} // init