本文整理汇总了C++中LabelWidget类的典型用法代码示例。如果您正苦于以下问题:C++ LabelWidget类的具体用法?C++ LabelWidget怎么用?C++ LabelWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LabelWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadedFromFile
void MainMenuScreen::loadedFromFile()
{
LabelWidget* w = getWidget<LabelWidget>("info_addons");
w->setScrollSpeed(15);
RibbonWidget* rw_top = getWidget<RibbonWidget>("menu_toprow");
assert(rw_top != NULL);
if (track_manager->getTrack("overworld") == NULL ||
track_manager->getTrack("introcutscene") == NULL ||
track_manager->getTrack("introcutscene2") == NULL)
{
rw_top->removeChildNamed("story");
}
#if DEBUG_MENU_ITEM != 1
RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow");
rw->removeChildNamed("test_gpwin");
rw->removeChildNamed("test_gplose");
rw->removeChildNamed("test_unlocked");
rw->removeChildNamed("test_unlocked2");
rw->removeChildNamed("test_intro");
rw->removeChildNamed("test_outro");
#endif
} // loadedFromFile
示例2: if
// ----------------------------------------------------------------------------
void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver)
{
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL)
{
if (addons_manager->wasError())
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(BAD_BADGE);
}
else if (addons_manager->isLoading() && UserConfigParams::m_internet_status
== INetworkHttp::IPERM_ALLOWED)
{
// Addons manager is still initialising/downloading.
addons_icon->setDeactivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(LOADING_BADGE);
}
else
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
}
// maybe add a new badge when not allowed to access the net
}
LabelWidget* w = getWidget<LabelWidget>("info_addons");
w->update(delta);
if(w->scrolledOff())
{
const core::stringw &news_text = news_manager->getNextNewsMessage();
w->setText(news_text, true);
}
} // onUpdate
示例3: init
// ----------------------------------------------------------------------------
void CreateServerScreen::init()
{
Screen::init();
DemoWorld::resetIdleTime();
m_info_widget->setText("", false);
LabelWidget *title = getWidget<LabelWidget>("title");
title->setText(NetworkConfig::get()->isLAN() ? _("Create LAN Server")
: _("Create Server") ,
false);
// I18n: Name of the server. %s is either the online or local user name
m_name_widget->setText(_("%s's server",
NetworkConfig::get()->isLAN()
? PlayerManager::getCurrentPlayer()->getName()
: PlayerManager::getCurrentOnlineUserName()
)
);
// -- Difficulty
RibbonWidget* difficulty = getWidget<RibbonWidget>("difficulty");
assert(difficulty != NULL);
difficulty->setSelection(UserConfigParams::m_difficulty, PLAYER_ID_GAME_MASTER);
// -- Game modes
RibbonWidget* gamemode = getWidget<RibbonWidget>("gamemode");
assert(gamemode != NULL);
gamemode->setSelection(0, PLAYER_ID_GAME_MASTER);
} // init
示例4: assert
// ----------------------------------------------------------------------------
//
void MainMenuScreen::init()
{
Screen::init();
m_user_id = getWidget<ButtonWidget>("user-id");
assert(m_user_id);
// reset in case we're coming back from a race
StateManager::get()->resetActivePlayers();
input_manager->getDeviceManager()->setAssignMode(NO_ASSIGN);
input_manager->getDeviceManager()->setSinglePlayer( NULL );
input_manager->setMasterPlayerOnly(false);
// Avoid incorrect behaviour in certain race circumstances:
// If a multi-player game is played with two keyboards, the 2nd
// player selects his kart last, and only the keyboard is used
// to select all other settings - then if the next time the kart
// selection screen comes up, the default device will still be
// the 2nd player. So if the first player presses 'select', it
// will instead add a second player (so basically the key
// binding for the second player become the default, so pressing
// select will add a new player). See bug 3090931
// To avoid this, we will clean the last used device, making
// the key bindings for the first player the default again.
input_manager->getDeviceManager()->clearLatestUsedDevice();
if (addons_manager->isLoading())
{
IconButtonWidget* w = getWidget<IconButtonWidget>("addons");
w->setDeactivated();
w->resetAllBadges();
w->setBadge(LOADING_BADGE);
}
m_online = getWidget<IconButtonWidget>("online");
if(!m_enable_online)
m_online->setDeactivated();
LabelWidget* w = getWidget<LabelWidget>("info_addons");
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
w->setText(news_text, true);
w->update(0.01f);
RibbonWidget* r = getWidget<RibbonWidget>("menu_bottomrow");
// FIXME: why do I need to do this manually
((IconButtonWidget*)r->getChildren().get(0))->unfocused(PLAYER_ID_GAME_MASTER, NULL);
((IconButtonWidget*)r->getChildren().get(1))->unfocused(PLAYER_ID_GAME_MASTER, NULL);
((IconButtonWidget*)r->getChildren().get(2))->unfocused(PLAYER_ID_GAME_MASTER, NULL);
r = getWidget<RibbonWidget>("menu_toprow");
r->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
DemoWorld::resetIdleTime();
#if _IRR_MATERIAL_MAX_TEXTURES_ < 8
getWidget<IconButtonWidget>("logo")->setImage("gui/logo_broken.png",
IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
#endif
} // init
示例5: Style
CharacterMenu::CharacterMenu( Drawer & drawer )
{
WidgetFactory& factory = WidgetFactory::getInstance();
// MAIN CONTAINER
Style * style = new Style();
style->setBackgroundImage( factory.getMenuBackground() );
rootContainer = new VerCenterContainer( style );
// TITLE
LabelWidget * lw = factory.getTitleLabel( Locale::get( "CHARACTER" ) );
lw->prepare( drawer );
rootContainer->addWidget( *lw );
// FORRM
playerNameForm = new Form( "setPlayerName" );
// BUTTONS
TextInputWidget* tiw = factory.getLargeTextInput( ".{1,15}", Config::playerName );
interactiveWidgets.push_back( tiw );
rootContainer->addWidget( *tiw );
playerNameForm->addWidget( *tiw );
ButtonWidget* bw = factory.getLargeSubmitButton( Locale::get( "BACK" ), "setmenu settings", *playerNameForm );
this->interactiveWidgets.push_back( bw );
rootContainer->addWidget( *bw );
}
示例6: loadedFromFile
// ----------------------------------------------------------------------------
void MessageDialog::loadedFromFile()
{
LabelWidget* message = getWidget<LabelWidget>("title");
message->setText( m_msg, false );
// If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
// change "Cancel" to "OK"
if (m_type == MessageDialog::MESSAGE_DIALOG_OK)
{
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
yesbtn->setVisible(false);
ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
cancelbtn->setText(_("OK"));
cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
else if (m_type == MessageDialog::MESSAGE_DIALOG_YESNO)
{
ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
cancelbtn->setText(_("No"));
}
else if (m_type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL)
{
// In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok'
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
yesbtn->setText(_("OK"));
}
}
示例7: _
// ----------------------------------------------------------------------------
void MainMenuScreen::onUpdate(float delta)
{
PlayerProfile *player = PlayerManager::getCurrentPlayer();
if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST ||
PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN)
{
m_user_id->setText(player->getLastOnlineName() + "@stk");
m_online->setActivated();
m_online->setLabel( _("Online"));
}
else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT)
{
m_online->setActivated();
m_online->setLabel( _("Login" ));
m_user_id->setText(player->getName());
}
else
{
// now must be either logging in or logging out
m_online->setDeactivated();
m_user_id->setText(player->getName());
}
m_online->setLabel(PlayerManager::getCurrentOnlineId() ? _("Online")
: _("Login" ) );
IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons");
if (addons_icon != NULL)
{
if (addons_manager->wasError())
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(BAD_BADGE);
}
else if (addons_manager->isLoading() && UserConfigParams::m_internet_status
== Online::RequestManager::IPERM_ALLOWED)
{
// Addons manager is still initialising/downloading.
addons_icon->setDeactivated();
addons_icon->resetAllBadges();
addons_icon->setBadge(LOADING_BADGE);
}
else
{
addons_icon->setActivated();
addons_icon->resetAllBadges();
}
// maybe add a new badge when not allowed to access the net
}
LabelWidget* w = getWidget<LabelWidget>("info_addons");
w->update(delta);
if(w->scrolledOff())
{
const core::stringw &news_text = NewsManager::get()->getNextNewsMessage();
w->setText(news_text, true);
}
} // onUpdate
示例8: loadedFromFile
void MainMenuScreen::loadedFromFile()
{
LabelWidget* w = getWidget<LabelWidget>("info_addons");
w->setScrollSpeed(15);
#if DEBUG_MENU_ITEM != 1
RibbonWidget* rw = getWidget<RibbonWidget>("menu_bottomrow");
rw->removeChildNamed("test_gpwin");
rw->removeChildNamed("test_gplose");
rw->removeChildNamed("test_unlocked");
rw->removeChildNamed("test_unlocked2");
#endif
} // loadedFromFile
示例9: rule
AboutDialog::AboutDialog()
{
LabelWidget *label = new LabelWidget;
label->setLabel(tr("Doomsday Shell %1\nCopyright (c) %2\n\n"
"The Shell is a utility for controlling and monitoring "
"Doomsday servers using a text-based (curses) user interface.")
.arg(SHELL_VERSION)
.arg("2013-2018 Deng Team"));
label->setExpandsToFitLines(true);
label->rule()
.setLeftTop(rule().left(), rule().top())
.setInput(Rule::Width, rule().width());
add(label);
rule().setSize(Const(40), label->rule().height());
}
示例10: processEvent
// -----------------------------------------------------------------------------
void EnterGPNameDialog::onEnterPressedInternal()
{
//Cancel button pressed
ButtonWidget* cancelButton = getWidget<ButtonWidget>("cancel");
if (GUIEngine::isFocusedForPlayer(cancelButton, PLAYER_ID_GAME_MASTER))
{
std::string fakeEvent = "cancel";
processEvent(fakeEvent);
return;
}
//Otherwise, see if we can accept the new name
TextBoxWidget* textCtrl = getWidget<TextBoxWidget>("textfield");
assert(textCtrl != NULL);
stringw name = textCtrl->getText().trim();
if (name.size() > 0)
{
// check for duplicate names
for (int i = 0; i < grand_prix_manager->getNumberOfGrandPrix(); i++)
{
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(i);
if (gp->getName() == name)
{
LabelWidget* label = getWidget<LabelWidget>("title");
assert(label != NULL);
label->setText(_("Another grand prix with this name already exists."), false);
sfx_manager->quickSound("anvil");
return;
}
}
// It's unsafe to delete from inside the event handler so we do it
// in onUpdate (which checks for m_self_destroy)
m_self_destroy = true;
}
else
{
LabelWidget* label = getWidget<LabelWidget>("title");
assert(label != NULL);
label->setText(_("Cannot add a grand prix with this name"), false);
sfx_manager->quickSound("anvil");
}
}
示例11: loadFromFile
void MessageDialog::doInit(MessageDialogType type,
IConfirmDialogListener* listener, bool own_listener)
{
if (StateManager::get()->getGameState() == GUIEngine::GAME)
{
World::getWorld()->schedulePause(World::IN_GAME_MENU_PHASE);
}
loadFromFile("confirm_dialog.stkgui");
m_listener = listener;
m_own_listener = own_listener;
LabelWidget* message = getWidget<LabelWidget>("title");
message->setText( m_msg.c_str(), false );
// If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
// change "Cancel" to "OK"
if (type == MessageDialog::MESSAGE_DIALOG_OK)
{
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
yesbtn->setVisible(false);
ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
cancelbtn->setText(_("OK"));
cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
else if (type == MessageDialog::MESSAGE_DIALOG_YESNO)
{
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
cancelbtn->setText(_("No"));
}
else if (type == MessageDialog::MESSAGE_DIALOG_OK_CANCEL)
{
// In case of a OK_CANCEL dialog, change the text from 'Yes' to 'Ok'
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
yesbtn->setText(_("OK"));
}
}
示例12: init
// ----------------------------------------------------------------------------
void CreateServerScreen::init()
{
Screen::init();
DemoWorld::resetIdleTime();
m_info_widget->setText("", false);
LabelWidget *title = getWidget<LabelWidget>("title");
title->setText(NetworkConfig::get()->isLAN() ? _("Create LAN Server")
: _("Create Server") ,
false);
// I18n: Name of the server. %s is either the online or local user name
m_name_widget->setText(_("%s's server",
NetworkConfig::get()->isLAN()
? PlayerManager::getCurrentPlayer()->getName()
: PlayerManager::getCurrentOnlineUserName()
)
);
} // init
示例13: init
// -----------------------------------------------------------------------------
void EditGPScreen::init()
{
if (m_action.empty())
{
LabelWidget* header = getWidget<LabelWidget>("title");
assert(header != NULL);
header->setText(m_gp->getName(), true);
IconButtonWidget* button = getWidget<IconButtonWidget>("save");
assert(button != NULL);
button->setDeactivated();
loadList(0);
setModified(false);
}
else
{
EditTrackScreen* edit = EditTrackScreen::getInstance();
assert(edit != NULL);
if (edit->getResult())
{
if (m_action == "add")
{
m_gp->addTrack(edit->getTrack(), edit->getLaps(), edit->getReverse(),
m_selected);
setSelected(m_selected + 1);
}
else if (m_action == "edit")
{
m_gp->editTrack(m_selected, edit->getTrack(), edit->getLaps(),
edit->getReverse());
}
setModified(true);
}
loadList(m_selected);
m_action.clear();
}
}
示例14: loadFromFile
void MessageDialog::doInit(irr::core::stringw msg, MessageDialogType type,
IConfirmDialogListener* listener, bool own_listener)
{
loadFromFile("confirm_dialog.stkgui");
m_listener = listener;
m_own_listener = own_listener;
LabelWidget* message = getWidget<LabelWidget>("title");
message->setText( msg.c_str(), false );
// If the dialog is a simple 'OK' dialog, then hide the "Yes" button and
// change "Cancel" to "OK"
if (type == MessageDialog::MESSAGE_DIALOG_OK)
{
ButtonWidget* yesbtn = getWidget<ButtonWidget>("confirm");
yesbtn->setVisible(false);
ButtonWidget* cancelbtn = getWidget<ButtonWidget>("cancel");
cancelbtn->setText(_("OK"));
cancelbtn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
}
}
示例15: ModalDialog
GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const float h) : ModalDialog(w, h)
{
doInit();
m_curr_time = 0.0f;
const int y1 = m_area.getHeight()/7;
const int y2 = m_area.getHeight()*6/7;
m_gp_ident = gpIdent;
const GrandPrixData* gp = grand_prix_manager->getGrandPrix(gpIdent);
if (gp == NULL)
{
assert(false);
std::cerr << "ERROR at " << __FILE__ << " : " << __LINE__ << "; trying to continue\n";
ModalDialog::dismiss();
return;
}
// ---- GP Name
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);
IGUIStaticText* title = GUIEngine::getGUIEnv()->addStaticText( translations->fribidize(gp->getName()),
area_top, false, true, // border, word wrap
m_irrlicht_window);
title->setTabStop(false);
title->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
// ---- Track listings
const std::vector<std::string>& tracks = gp->getTrackNames();
const int trackAmount = tracks.size();
int height_of_one_line = (y2 - y1)/(trackAmount+1);
const int textHeight = GUIEngine::getFontHeight();
if (height_of_one_line > (int)(textHeight*1.5f)) height_of_one_line = (int)(textHeight*1.5f);
bool gp_ok = true;
for (int t=0; t<trackAmount; t++)
{
const int from_y = y1 + height_of_one_line*(t+1);
Track* track = track_manager->getTrack(tracks[t]);
stringw lineText;
if (track == NULL)
{
lineText = L"MISSING : ";
lineText.append( stringw(tracks[t].c_str()) );
gp_ok = false;
}
else
{
lineText = track->getName();
}
LabelWidget* widget = new LabelWidget();
widget->setText(translations->fribidize(lineText), false);
widget->m_x = 20;
widget->m_y = from_y;
widget->m_w = m_area.getWidth()/2 - 20;
widget->m_h = height_of_one_line;
widget->setParent(m_irrlicht_window);
m_widgets.push_back(widget);
widget->add();
// IGUIStaticText* line = GUIEngine::getGUIEnv()->addStaticText( lineText.c_str(),
// entry_area, false , true , // border, word wrap
// m_irrlicht_window);
}
// ---- Track screenshot
m_screenshot_widget = new IconButtonWidget(IconButtonWidget::SCALE_MODE_KEEP_CUSTOM_ASPECT_RATIO,
false /* tab stop */, false /* focusable */,
IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE /* Track gives us absolute paths */);
// images are saved squared, but must be stretched to 4:3
m_screenshot_widget->setCustomAspectRatio(4.0f / 3.0f);
m_screenshot_widget->m_x = m_area.getWidth()/2;
m_screenshot_widget->m_y = y1;
m_screenshot_widget->m_w = m_area.getWidth()/2;
m_screenshot_widget->m_h = y2 - y1 - 10;
Track* track = track_manager->getTrack(tracks[0]);
m_screenshot_widget->m_properties[PROP_ICON] = (track != NULL ?
track->getScreenshotFile().c_str() :
file_manager->getAsset(FileManager::GUI,"main_help.png"));
m_screenshot_widget->setParent(m_irrlicht_window);
m_screenshot_widget->add();
m_widgets.push_back(m_screenshot_widget);
// ---- Start button
ButtonWidget* okBtn = new ButtonWidget();
ButtonWidget* continueBtn = new ButtonWidget();
SavedGrandPrix* saved_gp = SavedGrandPrix::getSavedGP( StateManager::get()
->getActivePlayerProfile(0)
//.........这里部分代码省略.........