本文整理汇总了C++中irr::core::stringw类的典型用法代码示例。如果您正苦于以下问题:C++ stringw类的具体用法?C++ stringw怎么用?C++ stringw使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了stringw类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: serverCreationRequest
// ----------------------------------------------------------------------------
void CreateServerScreen::serverCreationRequest()
{
const irr::core::stringw name = m_name_widget->getText().trim();
const int max_players = m_max_players_widget->getValue();
m_info_widget->setErrorColor();
if (name.size() < 4 || name.size() > 30)
{
m_info_widget->setText(_("Name has to be between 4 and 30 characters long!"), false);
}
else if (max_players < 2 || max_players > 12)
{
m_info_widget->setText(_("The maxinum number of players has to be between 2 and 12."), false);
}
else
{
m_server_creation_request = new ServerCreationRequest();
CurrentUser::setUserDetails(m_server_creation_request);
m_server_creation_request->addParameter("action", "create_server");
m_server_creation_request->addParameter("name", name);
m_server_creation_request->addParameter("max_players", max_players);
m_server_creation_request->queue();
return;
}
sfx_manager->quickSound("anvil");
}
开发者ID:Podmuch,项目名称:stk-code,代码行数:28,代码来源:create_server_screen.cpp
示例2: createServer
/** In case of WAN it adds the server to the list of servers. In case of LAN
* networking, it registers this game server with the stk server.
*/
void CreateServerScreen::createServer()
{
const irr::core::stringw name = m_name_widget->getText().trim();
const int max_players = m_max_players_widget->getValue();
m_info_widget->setErrorColor();
if (name.size() < 4 || name.size() > 30)
{
m_info_widget->setText(
_("Name has to be between 4 and 30 characters long!"), false);
SFXManager::get()->quickSound("anvil");
return;
}
else if (max_players < 2 || max_players > 12)
{
m_info_widget->setText(
_("The maxinum number of players has to be between 2 and 12."),
false);
SFXManager::get()->quickSound("anvil");
return;
}
// In case of a LAN game, we can create the new server object now
if (NetworkConfig::get()->isLAN())
{
// FIXME Is this actually necessary?? Only in case of WAN, or LAN and WAN?
TransportAddress address(0x7f000001,0); // 127.0.0.1
Server *server = new Server(name, /*lan*/true, max_players,
/*current_player*/1, address);
ServersManager::get()->addServer(server);
}
// In case of a WAN game, we register this server with the
// stk server, and will get the server's id when this
// request is finished.
NetworkConfig::get()->setMaxPlayers(max_players);
NetworkConfig::get()->setServerName(name);
// FIXME: Add the following fields to the create server screen
// FIXME: Long term we might add a 'vote' option (e.g. GP vs single race,
// and normal vs FTL vs time trial could be voted about).
race_manager->setDifficulty(RaceManager::convertDifficulty("hard"));
race_manager->setMajorMode(RaceManager::MAJOR_MODE_SINGLE);
race_manager->setMinorMode(RaceManager::MINOR_MODE_NORMAL_RACE);
race_manager->setReverseTrack(false);
STKHost::create();
} // createServer
开发者ID:bog-dan-ro,项目名称:stk-code,代码行数:50,代码来源:create_server_screen.cpp
示例3: setLabel
void ButtonWidget::setLabel(const irr::core::stringw &label)
{
// This method should only be called AFTER a widget is added
assert(m_element != NULL);
m_element->setText( label.c_str() );
setText(label);
}
开发者ID:Berulacks,项目名称:stk-code,代码行数:8,代码来源:button_widget.cpp
示例4: setLabel
// -----------------------------------------------------------------------------
void RibbonWidget::setLabel(const int id, irr::core::stringw new_name)
{
if (m_labels.size() == 0) return; // ignore this call for ribbons without labels
assert(id >= 0);
assert(id < m_labels.size());
m_labels[id].setText( new_name.c_str() );
m_text = new_name;
}
开发者ID:344717871,项目名称:STK_android,代码行数:10,代码来源:ribbon_widget.cpp
示例5: notEmpty
/** Checks if the input string is not empty. ( = has characters different
* from a space).
*/
bool notEmpty(const irr::core::stringw& input)
{
const int size = input.size();
int nonEmptyChars = 0;
for (int n=0; n<size; n++)
{
if (input[n] != L' ')
{
nonEmptyChars++;
}
}
return (nonEmptyChars > 0);
} // getExtension
开发者ID:rugk,项目名称:stk-code,代码行数:16,代码来源:string_utils.cpp
示例6: renameCell
// -----------------------------------------------------------------------------
void ListWidget::renameCell(const int row_index, const int col_index, const irr::core::stringw newName, const int icon)
{
// May only be called AFTER this widget has been add()ed
assert(m_element != NULL);
CGUISTKListBox* list = getIrrlichtElement<CGUISTKListBox>();
assert(list != NULL);
list->setCell(row_index, col_index, newName.c_str(), icon);
list->setItemOverrideColor( row_index, EGUI_LBC_TEXT , video::SColor(255,0,0,0) );
list->setItemOverrideColor( row_index, EGUI_LBC_TEXT_HIGHLIGHT, video::SColor(255,255,255,255) );
}
开发者ID:himanshuk303,项目名称:stk-code,代码行数:14,代码来源:list_widget.cpp
示例7: w_gettext
/**
* \param original Message to translate
* \param context Optional, can be set to differentiate 2 strings that are identical
* in English but could be different in other languages
*/
const wchar_t* Translations::w_gettext(const char* original, const char* context)
{
if (original[0] == '\0') return L"";
#if TRANSLATE_VERBOSE
Log::info("Translations", "Translating %s", original);
#endif
const std::string& original_t = (context == NULL ?
m_dictionary.translate(original) :
m_dictionary.translate_ctxt(context, original));
if (original_t == original)
{
static irr::core::stringw converted_string;
converted_string = StringUtils::utf8ToWide(original);
#if TRANSLATE_VERBOSE
std::wcout << L" translation : " << converted_string << std::endl;
#endif
return converted_string.c_str();
}
// print
//for (int n=0;; n+=4)
static core::stringw original_tw;
original_tw = StringUtils::utf8ToWide(original_t);
const wchar_t* out_ptr = original_tw.c_str();
if (REMOVE_BOM) out_ptr++;
#if TRANSLATE_VERBOSE
std::wcout << L" translation : " << out_ptr << std::endl;
#endif
return out_ptr;
}
开发者ID:TheDudeWithThreeHands,项目名称:A-StreamKart,代码行数:43,代码来源:translation.cpp
示例8: addUnlockedPicture
void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture,
float w, float h,
irr::core::stringw msg)
{
if (picture == NULL)
{
Log::warn("FeatureUnlockedCutScene::addUnlockedPicture", "Unlockable has no picture: %s",
core::stringc(msg.c_str()).c_str());
picture = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI,"main_help.png"));
}
m_unlocked_stuff.push_back( new UnlockedThing(picture, w, h, msg) );
} // addUnlockedPicture
开发者ID:jubalh,项目名称:stk-code,代码行数:14,代码来源:feature_unlocked.cpp
示例9: addUnlockedPicture
void FeatureUnlockedCutScene::addUnlockedPicture(irr::video::ITexture* picture,
float w, float h,
irr::core::stringw msg)
{
if (picture == NULL)
{
std::cerr << "[FeatureUnlockedCutScene::addUnlockedPicture] WARNING: unlockable has no picture : "
<< core::stringc(msg.c_str()).c_str() << "\n";
picture = irr_driver->getTexture(file_manager->getAsset(FileManager::GUI,"main_help.png"));
}
m_unlocked_stuff.push_back( new UnlockedThing(picture, w, h, msg) );
} // addUnlockedPicture
开发者ID:clasik,项目名称:stk-code,代码行数:14,代码来源:feature_unlocked.cpp
示例10: setValue
void SpinnerWidget::setValue(irr::core::stringw new_value)
{
const int size = (int)m_labels.size();
for (int n=0; n<size; n++)
{
if (m_labels[n] == new_value)
{
setValue(n);
return;
}
}
Log::fatal("SpinnerWidget::setValue", "Cannot find element named '%s'",
irr::core::stringc(new_value.c_str()).c_str());
}
开发者ID:jubalh,项目名称:stk-code,代码行数:15,代码来源:spinner_widget.cpp
示例11: setValue
void SpinnerWidget::setValue(irr::core::stringw new_value)
{
const int size = (int)m_labels.size();
for (int n=0; n<size; n++)
{
if (m_labels[n] == new_value)
{
setValue(n);
return;
}
}
std::cerr << "ERROR [SpinnerWidget::setValue] : cannot find element named '"
<< irr::core::stringc(new_value.c_str()).c_str() << "'\n";
assert(false);
}
开发者ID:shantanusingh10,项目名称:stk-code,代码行数:16,代码来源:spinner_widget.cpp
示例12: split
/** Splits a string into substrings separated by a certain character, and
* returns a std::vector of all those substring. E.g.:
* split("a b=c d=e",' ') --> ["a", "b=c", "d=e"]
* This is the version for wide strings.
* \param s The string to split.
* \param c The character by which the string is split.
*/
std::vector<irr::core::stringw> split(const irr::core::stringw& s, char c,
bool keepSplitChar)
{
try
{
std::vector<irr::core::stringw> result;
irr::s32 start = 0;
while (start < (irr::s32)s.size())
{
irr::s32 i = s.findNext(c, start);
if (i != -1)
{
if (keepSplitChar)
{
int from = start-1;
if (from < 0) from = 0;
result.push_back( s.subString(from, i-from) );
}
else result.push_back( s.subString(start, i-start) );
start = i+1;
}
else
{
if (keepSplitChar)
result.push_back( s.subString(start - 1,
s.size()-start + 1) );
else
result.push_back( s.subString(start, s.size()-start) );
return result;
//start = i+1;
}
}
return result;
}
catch (std::exception& e)
{
(void)e; // avoid warning about unused variable
Log::fatal("StringUtils",
"Fatal error in split(stringw) : %s @ line %i : '%s'.",
__FILE__, __LINE__, e.what());
exit(1);
}
} // split
开发者ID:jeremiejig,项目名称:paf-autostereoscopie-2014,代码行数:52,代码来源:string_utils.cpp
示例13: xmlEncode
/** Converts a unicode string to plain ASCII using XML entites (e.g. &x00;)
* \param s The input string which should be encoded.
* \return A std:;string with ASCII characters.
*/
std::string xmlEncode(const irr::core::stringw &s)
{
std::ostringstream output;
for(unsigned int i=0; i<s.size(); i++)
{
if (s[i] >= 128 || s[i] == '&' || s[i] == '<' || s[i] == '>' || s[i] == '\"')
{
output << "&#x" << std::hex << std::uppercase << s[i] << ";";
}
else
{
irr::c8 c = (char)(s[i]);
output << c;
}
}
return output.str();
} // xmlEncode
开发者ID:rugk,项目名称:stk-code,代码行数:21,代码来源:string_utils.cpp
示例14: setLabel
// ----------------------------------------------------------------------------
void RibbonWidget::setLabel(const unsigned int id, irr::core::stringw new_name)
{
if (m_element == NULL)
{
// before adding
m_children[id].setText(new_name);
}
else
{
// after adding
// ignore this call for ribbons without labels
if (m_labels.size() == 0) return;
assert(id < m_labels.size());
m_labels[id].setText(new_name.c_str());
//m_text = new_name;
}
} // setLabel
开发者ID:Elderme,项目名称:stk-code,代码行数:19,代码来源:ribbon_widget.cpp
示例15: encodeToHtmlEntities
/** Converts a unicode string to plain ASCII using html-like & codes.
* \param s The input string which should be encoded.
* \return A std:;string with ASCII characters.
*/
std::string encodeToHtmlEntities(const irr::core::stringw &s)
{
std::ostringstream output;
for(unsigned int i=0; i<s.size(); i++)
{
if(s[i]=='&')
output<<"&";
else
{
if(s[i]<128)
{
irr::c8 c=(char)(s[i]);
output<<c;
}
else
{
output <<"&#x" << std::hex <<std::uppercase<< s[i]<<";";
}
}
}
return output.str();
} // encodeToHtmlEntities
开发者ID:jeremiejig,项目名称:paf-autostereoscopie-2014,代码行数:26,代码来源:string_utils.cpp
示例16: doInit
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);
}
}
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:23,代码来源:message_dialog.cpp
示例17: getDescription
/** Returns the description of this achievement. */
irr::core::stringw getDescription() const { return _(m_description.c_str()); }
开发者ID:Cav098,项目名称:stk-code-fix_1797,代码行数:2,代码来源:achievement_info.hpp
示例18: getName
/** Returns the name of this achievement. */
irr::core::stringw getName() const { return _LTR(m_name.c_str()); }
开发者ID:Cav098,项目名称:stk-code-fix_1797,代码行数:2,代码来源:achievement_info.hpp
示例19: stringw_to_stdstring
std::string stringw_to_stdstring(irr::core::stringw sw)
{
std::stringstream ss;
ss << sw.c_str();
return ss.str();
}
开发者ID:Turupawn,项目名称:FighterAndroid,代码行数:6,代码来源:Input.cpp
示例20: selectItemWithLabel
void ListWidget::selectItemWithLabel(const irr::core::stringw& name)
{
CGUISTKListBox* list = getIrrlichtElement<CGUISTKListBox>();
assert(list != NULL);
return list->setSelectedByCellText( name.c_str() );
}
开发者ID:himanshuk303,项目名称:stk-code,代码行数:6,代码来源:list_widget.cpp
注:本文中的irr::core::stringw类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论