本文整理汇总了C++中cegui::String::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ String::c_str方法的具体用法?C++ String::c_str怎么用?C++ String::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::String
的用法示例。
在下文中一共展示了String::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeScriptFile
void CLuaManager::executeScriptFile(const CEGUI::String& filename, const CEGUI::String& resourceGroup)
{
// load file
CEGUI::RawDataContainer raw;
CEGUI::System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
// load code into lua
int loaderr = luaL_loadbuffer(m_luaVM, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
CEGUI::System::getSingleton().getResourceProvider()->unloadRawDataContainer(raw);
// call it
if (loaderr==0) { // run the file
int result = lua_pcall(m_luaVM,0,0,0);
switch (result) {
case LUA_ERRRUN:
CLog::getInstance()->error("Runtime error in %s", filename.c_str());
break;
case LUA_ERRMEM:
CLog::getInstance()->error("Memory alocation error in %s", filename.c_str());
break;
case LUA_ERRERR:
CLog::getInstance()->error("Error handler error in %s", filename.c_str());
break;
default:
break;
}
} else {
CLog::getInstance()->error("Unable to load %s", filename.c_str());
}
}
示例2: t
//-------------------------------------------------------------------------------------
bool
NetworkManager::connect(const CEGUI::EventArgs&)
{
CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
CEGUI::String Iptmp;
CEGUI::String PortTmp;
unsigned int i = 1;
if (winMgr->isWindowPresent("Connect/ContainerGrp/Ip"))
{
Iptmp = winMgr->getWindow("Connect/ContainerGrp/Ip")->getText();
PortTmp = winMgr->getWindow("Connect/ContainerGrp/Port")->getText();
this->ip_ = std::string(Iptmp.c_str());
this->port_ = StringToNumber<const char *, int>(PortTmp.c_str());
zappy::Convert *c = new zappy::Convert();
zappy::Network::initInstance(this->ip_ , this->port_, *c);
zappy::Network &p = zappy::Network::getInstance();
p.setParameters(this->port_, this->ip_);
p.connect_();
if (p.isConnected())
{
Thread<zappy::Network> t(p);
t.start();
while (p.gettingMap() && i < 5000)
usleep(++i);
this->GfxMgr_->hide("Connect");
this->GfxMgr_->createRealScene();
}
}
return true;
}
示例3: executeScriptGlobal
int CLuaManager::executeScriptGlobal(const CEGUI::String& function_name)
{
int top = lua_gettop(m_luaVM);
// get the function from lua
lua_getglobal(m_luaVM, function_name.c_str());
// is it a function
if (!lua_isfunction(m_luaVM,-1))
{
lua_settop(m_luaVM,top);
CLog::getInstance()->error("Unable to get Lua global: '%s' as name not represent a global Lua function", function_name.c_str());
return -1;
}
// call it
int error = lua_pcall(m_luaVM,0,1,0);
// handle errors
switch (error) {
case LUA_ERRRUN:
lua_settop(m_luaVM,top);
CLog::getInstance()->error("Runtime error in %s global function", function_name.c_str());
return -1;
case LUA_ERRMEM:
lua_settop(m_luaVM,top);
CLog::getInstance()->error("Memory alocation error in %s global function", function_name.c_str());
return -1;
case LUA_ERRERR:
lua_settop(m_luaVM,top);
CLog::getInstance()->error("Error handler error in %s global function", function_name.c_str());
return -1;
default:
break;
}
// get return value
if (!lua_isnumber(m_luaVM,-1))
{
// log that return value is invalid. return -1 and move on.
lua_settop(m_luaVM,top);
CLog::getInstance()->error("Unable to get Lua global : '%s' return value as it's not a number", function_name.c_str());
return -1;
}
int ret = (int)lua_tonumber(m_luaVM,-1);
lua_pop(m_luaVM,1);
// return it
return ret;
}
示例4: _RegisterControlToScript
VOID CUIWindowItem::_RegisterControlToScript(CEGUI::Window* pWindow)
{
//设置UserData,用于回朔调用
pWindow->setUserData(this);
//Register Me
LUA_CONTROL::Window* pTempControl = LUA_CONTROL::Window::CreateControl(pWindow);
LuaObject objThis = g_pScriptSys->GetLuaState()->BoxPointer(pTempControl);
objThis.SetMetaTable(*(pTempControl->GetMetaTable()));
CEGUI::String strTemp = pWindow->getName();
m_pScriptEnv->GetLuaObject()->SetObject(strTemp.c_str(), objThis);
m_vAllControl.push_back(pTempControl);
//对ActionButton特殊处理
if(pWindow->testClassName((CEGUI::utf8*)"FalagardActionButton"))
{
CEGUI::IFalagardActionButton* pActionButton = (CEGUI::IFalagardActionButton*)(CEGUI::FalagardActionButton*)pWindow;
//DrawStarted
pActionButton->subscribeDragDropStartedEvent(CEGUI::Event::Subscriber(&CUISystem::handleActionDragDropStarted, CUISystem::GetMe()));
//MouseEnter
pActionButton->subscribeMouseEnterEvent(CEGUI::Event::Subscriber(&CUISystem::handleActionButtonMouseEnter, CUISystem::GetMe()));
//MouseLeave
pActionButton->subscribeMouseLeaveEvent(CEGUI::Event::Subscriber(&CUISystem::handleActionButtonMouseLeave, CUISystem::GetMe()));
//ParentHidden
pWindow->subscribeEvent((CEGUI::utf8*)"ParentHidden", CEGUI::Event::Subscriber(&CUISystem::handleActionButtonParentHidden, CUISystem::GetMe()));
}
else if(pWindow->testClassName((CEGUI::utf8*)"FalagardMeshWindow"))
{
CEGUI::IFalagardMeshWindow* pMeshWindow = (CEGUI::IFalagardMeshWindow*)(CEGUI::FalagardMeshWindow*)pWindow;
pMeshWindow->subscribeShownEvent(CEGUI::Event::Subscriber(&CUISystem::handleMeshWindowShown, CUISystem::GetMe()));
pMeshWindow->subscribeHidenEvent(CEGUI::Event::Subscriber(&CUISystem::handleMeshWindowHiden, CUISystem::GetMe()));
}
else if(pWindow->testClassName((CEGUI::utf8*)"FalagardComplexWindow"))
{
CEGUI::IFalagardComplexWindow* pComplexWindow = (CEGUI::IFalagardComplexWindow*)(CEGUI::FalagardComplexWindow*)pWindow;
pComplexWindow->subscribInfoItemClickEvent(CEGUI::Event::Subscriber(&CUISystem::handleChatHistoryInfoElementClick, CUISystem::GetMe()));
pComplexWindow->subscribInfoItemDeleteEvent(CEGUI::Event::Subscriber(&CUISystem::handleElementDelete, CUISystem::GetMe()));
}
else if(pWindow->testClassName((CEGUI::utf8*)"FalagardChatHistory"))
{
CEGUI::IFalagardChatHistory* pChatHistoryWindow = (CEGUI::IFalagardChatHistory*)(CEGUI::FalagardChatHistory*)pWindow;
pChatHistoryWindow->subscribInfoItemClickEvent(CEGUI::Event::Subscriber(&CUISystem::handleChatHistoryInfoElementClick, CUISystem::GetMe()));
pChatHistoryWindow->subscribInfoItemDeleteEvent(CEGUI::Event::Subscriber(&CUISystem::handleElementDelete, CUISystem::GetMe()));
pChatHistoryWindow->subscribInfoItemMoveInEvent(CEGUI::Event::Subscriber(&CUISystem::handleChatHistoryInfoElementMoveIn, CUISystem::GetMe()));
pChatHistoryWindow->subscribInfoItemMoveOutEvent(CEGUI::Event::Subscriber(&CUISystem::handleChatHistoryInfoElementMoveOut, CUISystem::GetMe()));
}
//Register Child
for(INT i=0; i<(INT)pWindow->getChildCount(); i++)
{
_RegisterControlToScript(pWindow->getChildAtIdx(i));
}
return;
}
示例5: setValues
void SettingComboBox::setValues(const CEGUI::String& value)
{
valuesString = value;
values.clear();
std::vector<std::string> pairs;
Tokenize(value.c_str(), pairs, ";");
std::vector<std::string>::const_iterator it = pairs.begin();
for (; it != pairs.end(); it++)
{
std::vector<std::string> pair;
Tokenize(*it, pair, ":");
if (pair.size() != 2)
{
printf("E: setValues failed.\n");
continue;
}
std::vector<std::string> vals;
Tokenize(pair[1], vals, ",");
values[pair[0]] = vals;
}
Update();
}
示例6: OnPlayerShopBuyNumChange
bool OnPlayerShopBuyNumChange(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CEGUI::String buyNum = wnd->getText();
char str[32] = "";
CEGUI::Window* goodsWnd = wnd->getParent();
if (goodsWnd)
{
CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
if (!goods) return false;
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
ulong num = atoi(buyNum.c_str());
if (num>=pGoodsItem->groupNum)
{
sprintf(str,"%d",pGoodsItem->groupNum);
}
else if (num<=0)
{
sprintf(str,"%d",0);
}
sprintf(str,"%d",num);
wnd->setText(ToCEGUIString(str));
pGoodsItem->readyTradeNum = num;
}
}
return true;
}
示例7: Initial
VOID CUIIconsManager::Initial(VOID)
{
CEGUI::ImagesetManager& theImagesetMng = CEGUI::ImagesetManager::getSingleton();
//遍历所有的Imageset
CEGUI::ImagesetManager::ImagesetIterator it = theImagesetMng.getIterator();
for(it.toStart(); !it.isAtEnd(); it++)
{
const CEGUI::String strName = it.getCurrentKey();
const CEGUI::Imageset* pImageset = it.getCurrentValue();
const CEGUI::String& strTextureName = pImageset->getTextureFilename();
if(strTextureName.substr(0, 5) == CEGUI::String("Icons"))
{
//遍历Imageset中所有Image
CEGUI::Imageset::ImageIterator itImage = pImageset->getIterator();
for(itImage.toStart(); !itImage.isAtEnd(); itImage++)
{
const CEGUI::String strImageName = itImage.getCurrentKey();
const CEGUI::Image* pImage = &(itImage.getCurrentValue());
m_mapAllIcons.insert(std::make_pair(strImageName.c_str(), pImageset));
}
}
}
}
示例8: getSampleInstanceFromDLL
void SampleDataModule::getSampleInstanceFromDLL()
{
// assert(false && "This doesn't work in emscripten");
/* CEGUI::DynamicModule* sampleModule = new CEGUI::DynamicModule(d_name);
getSampleInstance functionPointerGetSample = (getSampleInstance)sampleModule->getSymbolAddress(CEGUI::String(GetSampleInstanceFuncName));
if(functionPointerGetSample == 0)
{
CEGUI::String errorMessage = "The sample creation function is not defined in the dynamic library of " + d_name;
CEGUI_THROW(CEGUI::InvalidRequestException(errorMessage.c_str()));
}
d_sample = &(functionPointerGetSample());*/
SAMPLE_CASE( HelloWorldDemo );
SAMPLE_CASE( LookNFeelOverviewDemo );
SAMPLE_CASE( GameMenuDemo );
SAMPLE_CASE( HUDDemo );
SAMPLE_CASE( DragDropDemo );
SAMPLE_CASE( InventoryDemo );
SAMPLE_CASE( EffectsDemo );
SAMPLE_CASE( FontDemo );
SAMPLE_CASE( Demo6 );
SAMPLE_CASE( EditboxValidationDemo );
SAMPLE_CASE( Minesweeper );
SAMPLE_CASE( ScrollablePaneDemo );
SAMPLE_CASE( TabControlDemo );
SAMPLE_CASE( WidgetDemo );
SAMPLE_CASE( TextDemo );
SAMPLE_CASE( TreeDemo );
CEGUI::String errorMessage = "Could not find sample " + d_name;
CEGUI_THROW(CEGUI::InvalidRequestException(errorMessage.c_str()));
}
示例9: OnPlayerShopShowGoodsInfo
bool OnPlayerShopShowGoodsInfo(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CGoods* goods = static_cast<CGoods*>(wnd->getUserData());
if (!goods) return false;
CEGUI::DefaultWindow* iconWnd = WDefaultWindow(GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Icon"));
CEGUI::Window* nameWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Name");
CEGUI::Window* oneGroupNumWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/OneGroupNum");
CEGUI::Window* priceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/Price");
CEGUI::Window* averagePriceWnd = GetWndMgr().getWindow("PlayerShop/backgrond/GoodsInfo/AveragePrice");
if (!iconWnd || !nameWnd || !oneGroupNumWnd || !priceWnd || !averagePriceWnd)
return false;
char tempText[256];
char strImageFilePath[128] = "";
char strImageFileName[128] = "";
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
// 物品名字
DWORD dwNameSize = (DWORD)strlen(pGoodsItem->strGoodsName.c_str());
if (dwNameSize>20)
{
_snprintf(tempText,21,"%s", pGoodsItem->strGoodsName.c_str());
sprintf((tempText+20),"...");
}else
sprintf(tempText,"%s", pGoodsItem->strGoodsName.c_str());
nameWnd->setText(ToCEGUIString(tempText));
// 物品图片
const char *strIconPath = GetGame()->GetPicList()->GetPicFilePathName(CPicList::PT_GOODS_ICON, pGoodsItem->goodsIconId);
GetFilePath(strIconPath,strImageFilePath);
GetFileName(strIconPath,strImageFileName);
CEGUI::String strImagesetName = "GoodIcon/";
strImagesetName += strImageFileName;
SetBackGroundImage(iconWnd,strImagesetName.c_str(),strImageFilePath,strImageFileName);
// 物品单组个数
sprintf(tempText,"%d",pGoodsItem->oneGroupNum);
oneGroupNumWnd->setText(ToCEGUIString(tempText));
// 物品售价
sprintf(tempText,"%d", pGoodsItem->price);
priceWnd->setText(ToCEGUIString(tempText));
// 物品单个均价
char strGoodsPrice[64] = "",strNumLen[64] = "";
sprintf(strNumLen,"%d",pGoodsItem->price/pGoodsItem->oneGroupNum);
float fPrice = static_cast<float>(pGoodsItem->price)/static_cast<float>(pGoodsItem->oneGroupNum);
sprintf(strGoodsPrice,"%*.2f",(int)strlen(strNumLen)+2,fPrice);
averagePriceWnd->setText(ToCEGUIString(strGoodsPrice));
}
return true;
}
示例10: ParseText
float GameState::ParseText(CEGUI::String ToParse)
{
float returnval = std::stof(ToParse.c_str());;
return returnval;
}
示例11: if
void cOverworld :: elementEnd( const CEGUI::String &element )
{
if( element == "property" || element == "Property" )
{
return;
}
if( element == "information" )
{
m_engine_version = m_xml_attributes.getValueAsInteger( "engine_version" );
m_last_saved = string_to_int64( m_xml_attributes.getValueAsString( "save_time" ).c_str() );
}
else if( element == "settings" )
{
// Author
//author = m_xml_attributes.getValueAsString( "author" ).c_str();
// Version
//version = m_xml_attributes.getValueAsString( "version" ).c_str();
// Music
m_musicfile = xml_string_to_string( m_xml_attributes.getValueAsString( "music" ).c_str() );
// Camera Limits
//pOverworld_Manager->camera->Set_Limits( GL_rect( static_cast<float>(m_xml_attributes.getValueAsInteger( "cam_limit_x" )), static_cast<float>(m_xml_attributes.getValueAsInteger( "cam_limit_y" )), static_cast<float>(m_xml_attributes.getValueAsInteger( "cam_limit_w" )), static_cast<float>(m_xml_attributes.getValueAsInteger( "cam_limit_h" )) ) );
}
else if( element == "player" )
{
// Start Waypoint
m_player_start_waypoint = m_xml_attributes.getValueAsInteger( "waypoint" );
// Moving State
m_player_moving_state = static_cast<Moving_state>(m_xml_attributes.getValueAsInteger( "moving_state" ));
}
else if( element == "background" )
{
m_background_color = Color( static_cast<Uint8>(m_xml_attributes.getValueAsInteger( "color_red" )), m_xml_attributes.getValueAsInteger( "color_green" ), m_xml_attributes.getValueAsInteger( "color_blue" ) );
}
else
{
// get World object
cSprite *object = Create_World_Object_From_XML( element, m_xml_attributes, m_engine_version, m_sprite_manager, this );
// valid
if( object )
{
m_sprite_manager->Add( object );
}
else if( element == "overworld" )
{
// ignore
}
else if( element.length() )
{
printf( "Warning : Overworld Unknown element : %s\n", element.c_str() );
}
}
// clear
m_xml_attributes = CEGUI::XMLAttributes();
}
示例12: deleteSelectedWindow
void CUIEditorView::deleteSelectedWindow(void)
{
if(m_pSelectedWindow)
{
CEGUI::String szDelName = m_pSelectedWindow->getName();
g_DataPool.OnDeleteWindow(szDelName.c_str());
setWindowSelected("");
CEGUI::WindowManager::getSingleton().destroyWindow(szDelName);
}
}
示例13: executeScriptGlobal
int FalconScriptingModule::executeScriptGlobal(const CEGUI::String& function_name)
{
Falcon::Item* func = d_vm->findGlobalItem(Falcon::String(function_name.c_str()));
if(func != NULL && func->isCallable()) {
d_vm->callItem(*func, 0);
d_vm->reset();
Falcon::Item& ret = d_vm->regA();
return ret.forceInteger();
}
return 0;
}
示例14: FillProperties
void CGUIElement_Impl::FillProperties ( void )
{
CEGUI::Window::PropertyIterator itPropertySet = ((CEGUI::PropertySet*)m_pWindow)->getIterator ();
while ( !itPropertySet.isAtEnd () ) {
CEGUI::String strKey = itPropertySet.getCurrentKey ();
CEGUI::String strValue = m_pWindow->getProperty ( strKey );
const char *szKey = strKey.c_str ();
const char *szValue = strValue.c_str ();
CGUIProperty* pProperty = new CGUIProperty;
pProperty->szKey = new char[strlen ( szKey ) + 1];
pProperty->szValue = new char[strlen ( szValue ) + 1];
strcpy ( pProperty->szKey, szKey );
strcpy ( pProperty->szValue, szValue );
m_Properties.push_back ( pProperty );
itPropertySet++;
}
}
示例15: executeScriptedEventHandler
bool FalconScriptingModule::executeScriptedEventHandler(const CEGUI::String& handler_name, const CEGUI::EventArgs& e)
{
Falcon::Item* func = d_vm->findGlobalItem(Falcon::String(handler_name.c_str()));
if(func != NULL && func->isCallable()) {
d_vm->pushParam(3);
d_vm->callItem(*func, 1);
d_vm->reset();
Falcon::Item& ret = d_vm->regA();
return ret.isBoolean() ? ret.asBoolean() : true;
}
return false;
}