本文整理汇总了C++中DiString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ DiString::c_str方法的具体用法?C++ DiString::c_str怎么用?C++ DiString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiString
的用法示例。
在下文中一共展示了DiString::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NotifyPointMove
void CurveEditor::NotifyPointMove(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id)
{
if (_id != MyGUI::MouseButton::Left)
return;
if (!CheckPosition(_left, _top))
return;
auto pos = MyGUI::IntPoint(_left, _top) - _sender->getCroppedParent()->getAbsolutePosition();
auto value = GetValue(pos.left, pos.top);
pos.left -= 7;
pos.top -= 7;
_sender->setPosition(pos);
DiString str;
str.Format("%.3g", value.x);
mEditTimeEditBox->setCaption(str.c_str());
str.Format("%.3g", value.y);
mEditValueEditBox->setCaption(str.c_str());
std::sort(mButtons.begin(), mButtons.end(),
[](MyGUI::Button* a, MyGUI::Button* b) {
return a->getPosition().left < b->getPosition().left;
});
RefreshCurve();
}
示例2: main
int main(int numargs, char** args)
{
if (numargs < 2)
return -1;
parseArgs(numargs, args);
auto root = OGRE_NEW Ogre::Root("", "", "ogre.log");
root->loadPlugin("RenderSystem_Direct3D9_d");
root->setRenderSystem(root->getRenderSystemByName("Direct3D9 Rendering Subsystem"));
root->getRenderSystem()->setConfigOption("Full Screen","No");
root->initialise(true);
converterMgr = new ConverterMgr();
CovOptions option;
option.source = srcName.c_str();
option.dest = destName.c_str();
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(srcName.ExtractDirName().c_str(),"FileSystem");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
if (isAnimation)
{
converterMgr->SkeletonToMotion(option);
}
else
{
converterMgr->MeshToModel(option);
}
delete converterMgr;
delete root;
return 0;
}
示例3: data
DiDataStreamPtr DiK2Configs::GetDataStream(const DiString& relPath, K2ResourceType type)
{
#ifdef _K2_RECORD_USED_RESOURCE
sUsedResources.insert(relPath);
#endif
DiString full = GetK2MediaPath(relPath, type == K2_RES_TEXTURE);
if (RESOURCE_PACK)
{
DiDataStreamPtr data = RESOURCE_PACK->Open(full);
return data;
}
else
{
// now we just simply using OS's file system
FILE* fp = fopen(full.c_str(), type == K2_RES_XML ? "r" : "rb");
if (!fp)
{
DI_WARNING("Cannot open the file: %s", full.c_str());
return nullptr;
}
DiDataStreamPtr data(DI_NEW DiFileHandleDataStream(fp));
return data;
}
}
示例4: SetAttribute
void CurveEditor::SetAttribute(DiAttributeCurved& rhs)
{
rhs.CopyTo(&mCurvedAttr);
mSplineButton->setStateSelected(mCurvedAttr.GetInterpolationType() == IT_SPLINE);
// delete all buttons
for (auto i : mButtons)
mCanvasWidget->_destroyChildWidget(i);
mButtons.clear();
auto& pts = mCurvedAttr.GetControlPoints();
float minVal = 0;
float maxVal = 10;
// calculate the range
for (auto p : pts)
{
minVal = DiMath::Min(minVal, p.y);
maxVal = DiMath::Max(maxVal, p.y);
}
float defaultRangeMin = 0;
float defaultRangeMax = 10;
if(minVal < 0)
{
int v = minVal / 10 - 1;
minVal = v * 10;
}
if(maxVal > 10)
{
int v = maxVal / 10 + 1;
maxVal = v * 10;
}
DiString temp;
temp.Format("%g", minVal);
mRangeMinEditBox->setCaption(temp.c_str());
temp.Format("%g", maxVal);
mRangeMaxEditBox->setCaption(temp.c_str());
RefreshRange();
// add buttons
for (auto p : pts)
{
auto point = GetButtonPoint(p);
AddButton(point.left, point.top);
}
}
示例5: SetStringVar
bool DiCommandManager::SetStringVar(const DiString& name, const DiString& var)
{
DiConsoleVar* cv = GetConsoleVar(name);
if(!cv)
return false;
if(cv->GetType() != CONSOLE_VAR_STRING)
{
DI_WARNING("Cannot set come variable : %s, bad type cast", name.c_str());
return false;
}
DiConsoleVariableString* v = (DiConsoleVariableString*)cv;
v->Set(var.c_str());
return true;
}
示例6: Command_ToolNew
void DiEditorManager::Command_ToolNew(const MyGUI::UString& _commandName, bool& _result)
{
DiString msg;
if (!mFxFileName.empty())
msg = "Do you want to keep the new effects?";
else
msg = "Do you want to save the effects?";
auto msgBox = MyGUI::Message::createMessageBox("Message", "New",
msg.c_str(),
MyGUI::MessageBoxStyle::Yes|MyGUI::MessageBoxStyle::No|
MyGUI::MessageBoxStyle::Cancel|MyGUI::MessageBoxStyle::IconDefault);
msgBox->eventMessageBoxResultLambda = [this](MyGUI::Message*, MyGUI::MessageBoxStyle style){
if(style == MyGUI::MessageBoxStyle::Yes)
{
SaveAll();
NewFx();
}
else if(style == MyGUI::MessageBoxStyle::No)
{
NewFx();
}
};
_result = true;
}
示例7: xmlfile
void DiK2Configs::LoadConfig(const DiString& config)
{
auto file = DiAssetManager::GetInstance().OpenArchive(config, true);
if (!file)
{
DI_WARNING("Failed to load the config: %s", config.c_str());
return;
}
shared_ptr<DiXMLFile> xmlfile(new DiXMLFile());
xmlfile->Load(file->GetAsString());
DiXMLElement node = xmlfile->GetRoot();
DiXMLElement child = node.GetChild();
while (child)
{
DiString name = child.GetName();
if (name == "Property")
{
DiString key = child.GetAttribute("key");
DiString val = child.GetAttribute("value");
CommandMgr->RegisterString(key, val, 0);
}
child = child.GetNext();
}
}
示例8: ReadAttachParents
void DiMotionSerializerImpl::ReadAttachParents( DiDataStreamPtr& stream,DiAttachSet* attachset,DiSkeleton* skeleton )
{
DiString strChildName = ReadString(stream);
DiString strParentName = ReadString(stream);
DiNode* son = attachset->GetAttachNode(strChildName);
DiNode* parent = NULL;
parent = attachset->GetAttachNode(strParentName);
if(!parent && skeleton)
{
if(skeleton->HasBone(strParentName))
{
parent = skeleton->GetBone(strParentName);
}
}
if(parent)
{
parent->AddChild(son);
}
else
{
DI_WARNING("No parent : %s",strParentName.c_str());
}
}
示例9: an
DiTexturePtr DiShaderParameter::WriteTexture2D( const DiString& name,
const DiString& textureName )
{
DiString texfile = textureName;
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
if(texfile.CheckFileExtension("dds"))
texfile = texfile.ExtractBaseName() + ".pvr";
#endif
//DI_LOG("Writing 2d texture name: %s, %s [%x]", name.c_str(), textureName.c_str(),this);
DiAssetManager& assetMgr = DiAssetManager::GetInstance();
DiTexturePtr textureAsset = assetMgr.GetAsset<DiTexture>(texfile);
if (!textureAsset)
{
textureAsset = DiTexture::GetDefaultTexture();
DI_WARNING("Cannot write the texture(%s), using default texture", texfile.c_str());
}
auto it = mShaderParams[VARIABLE_SAMPLER2D].find(name);
if (it != mShaderParams[VARIABLE_SAMPLER2D].end())
{
DiTexture* tex = textureAsset.get();
DiAny an(tex);
it->second = an;
}
return textureAsset;
}
示例10: GenerateControllerName
DiString DiEditorManager::GenerateControllerName(const DiString& type)
{
static int id = 0;
DiString ret;
ret.Format("%s_%d", type.c_str(), id++);
return ret;
}
示例11: Update
void DiInfo::Update(float delta)
{
//Change("FPS", 1.0f / delta);
if (mInfo != nullptr)
{
//std::ostringstream stream;
//for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter)
//{
// if (iter != mParams.begin())
// stream << "\n";
// stream << iter->first << " :\t" << iter->second;
//}
//mInfo->setCaption(stream.str());
DiString info = DiProfiler::GetInstancePtr()->GetData();
DiString fps;
fps.Format("\nFPS: %f", 1.0f / delta);
info += fps;
mInfo->setCaption(info.c_str());
DI_PROFILE_BEGIN_INTERVAL
MyGUI::ISubWidgetText* text = mInfo->getSubWidgetText();
if (text != nullptr)
{
const MyGUI::IntSize& size = text->getTextSize() + mInfo->getSize() - text->getSize();
const MyGUI::IntSize& size_view = MyGUI::RenderManager::getInstance().getViewSize();
mInfo->setCoord(10, 10, size.width, size.height);
}
}
}
示例12: OutputLog
void DiConsoleLogger::OutputLog(const char* szMessage, const char* levelInfo)
{
static DiLogInfo logInfo;
if (::IsWindow(mWnd))
{
DiString msg = szMessage;
DiString lv = levelInfo;
logInfo.type = LOG_LEVEL_LOG;
if (lv == "error")
logInfo.type = LOG_LEVEL_ERROR;
else if (lv == "info")
logInfo.type = LOG_LEVEL_LOG;
else if (lv == "debug")
logInfo.type = LOG_LEVEL_DEBUG;
else if (lv == "warning")
logInfo.type = LOG_LEVEL_WARNING;
else
logInfo.type = 0xFFFF;
if (Driver)
logInfo.hwnd = mMainHwnd;
ZeroMemory(logInfo.message, sizeof(logInfo.message));
strcpy_s(logInfo.message, 4096, msg.c_str());
COPYDATASTRUCT cpd;
cpd.dwData = 0;
cpd.cbData = sizeof(logInfo);
cpd.lpData = &logInfo;
::SendMessage(mWnd, WM_COPYDATA, 0, (LPARAM)(LPVOID)&cpd);
}
}
示例13: ReadSubMesh
void DiMeshSerializerImpl::ReadSubMesh( DiDataStreamPtr& stream, DiMesh* pMesh )
{
DI_SERIAL_LOG("Reading submesh..");
DiSubMesh* sm = pMesh->CreateSubMesh();
unsigned short streamID = 0;
DiString material = ReadString(stream);
sm->SetMaterialName(material);
DI_SERIAL_LOG("Liking material: %s", material.c_str());
unsigned int indexCount = 0;
ReadInts(stream, &indexCount, 1);
DI_SERIAL_LOG("Indeices count: %d", indexCount);
bool idx32bit;
ReadBools(stream, &idx32bit, 1);
DI_SERIAL_LOG("Index size: %d", idx32bit?32:16);
uint16 primitive;
ReadShorts(stream,&primitive,1);
sm->SetPrimitiveType((DiPrimitiveType)primitive);
DI_SERIAL_LOG("Primitive type: %d", primitive);
if (indexCount > 0)
{
void* indexdata = sm->CreateIndexData(indexCount,idx32bit?TRUE:FALSE);
int size = indexCount * (sm->GetIndexSize() / 8);
stream->Read(indexdata, size);
DI_SERIAL_LOG("%d bytes readed", size);
}
streamID = ReadChunk(stream);
if (streamID != DI_GEOMETRY)
{
DI_ERROR("Bad stream ID");
return;
}
ReadGeometry(stream, sm);
if (!stream->Eof())
{
streamID = ReadChunk(stream);
if (streamID == DI_MESH_WEIGHTS)
{
ReadSubMeshBoneWeights(stream,sm);
}
else
{
if (!stream->Eof())
stream->Skip(-MSTREAM_OVERHEAD_SIZE);
}
}
}
示例14: WriteTextureCUBE
DiTexturePtr DiShaderParameter::WriteTextureCUBE( const DiString& name,
const DiString& textureName )
{
DiString texfile = textureName;
#if DEMI_PLATFORM == DEMI_PLATFORM_IOS
if(texfile.CheckFileExtension("dds"))
texfile = texfile.ExtractBaseName() + ".pvr";
#endif
DiAssetManager& assetMgr = DiAssetManager::GetInstance();
DiTexturePtr textureAsset = assetMgr.GetAsset<DiTexture>(texfile);
if (!textureAsset)
{
DI_WARNING("Failed to load the textureCUBE resource : %s",texfile.c_str());
return DiTexturePtr();
}
auto it = mShaderParams[VARIABLE_SAMPLERCUBE].find(name);
if (it != mShaderParams[VARIABLE_SAMPLERCUBE].end())
{
DiTexture* tex = textureAsset.get();
DiAny an(tex);
it->second = an;
}
return textureAsset;
}
示例15: altitude
void DiK2World::Load(const DiString& path)
{
DI_LOG("Loading world: %s", path.c_str());
DiK2WorldSerial serial;
serial.Load(path,this);
mRootNode->AttachObject(mTerrain);
// sun light
mSun = make_shared<DiDirLight>();
DiSceneManager* sm = DiBase::Driver->GetSceneManager();
DiCullNode* dirNode = sm->GetRootNode()->CreateChild();
dirNode->AttachObject(mSun);
mSun->SetColor(DiColor());
DiRadian altitude(DiDegree(mConfigs.mSunAltitude));
DiVec3 dir(0,-DiMath::Sin(altitude),DiMath::Cos(altitude));
DiRadian azimuth(DiDegree(mConfigs.mSunAzimuth));
DiQuat rot(azimuth, DiVec3::UNIT_Y);
dir = rot * dir;
mSun->SetDirection(dir);
sm->SetAmbientColor(DiColor());
Demi::DiRenderBatchGroup* group = Driver->GetPipeline()->GetBatchGroup(Demi::BATCH_MODEL);
group->SetPreProcess([this](){
Driver->GetPipeline()->GetShaderEnvironment()->globalAmbient = mConfigs.mEntityAmbient;
Driver->GetPipeline()->GetShaderEnvironment()->dirLightsColor[0] = mConfigs.mEntitySunColor;
});
}