本文整理汇总了C++中nglPath::GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ nglPath::GetChildren方法的具体用法?C++ nglPath::GetChildren怎么用?C++ nglPath::GetChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nglPath
的用法示例。
在下文中一共展示了nglPath::GetChildren方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: name
nuiSpriteDef::nuiSpriteDef(const nglPath& rSpriteDefPath)
{
Init();
nglString name(rSpriteDefPath.GetNodeName());
SetObjectName(name);
std::map<nglString, nuiSpriteDef*>::const_iterator it = mSpriteMap.find(name);
if (it != mSpriteMap.end())
it->second->Release();
mSpriteMap[name] = this;
{
std::list<nglPath> children;
rSpriteDefPath.GetChildren(&children);
std::list<nglPath>::const_iterator it = children.begin();
std::list<nglPath>::const_iterator end = children.end();
for (; it != end; it++)
{
nuiSpriteAnimation* pAnim = new nuiSpriteAnimation(*it);
if (pAnim->GetFrameCount())
AddAnimation(pAnim);
else
delete pAnim;
}
}
}
示例2: LoadLanguages
bool nuiTranslator::LoadLanguages(const nglPath& rLanguageFilesFolder)
{
mFiles.clear();
std::list<nglPath> Children;
rLanguageFilesFolder.GetChildren(&Children);
std::list<nglPath>::iterator it = Children.begin();
std::list<nglPath>::iterator end = Children.end();
while (it != end)
{
const nglPath& rPath(*it);
NGL_OUT(_T("Localization file: %ls\n"), rPath.GetChars());
if (rPath.GetExtension() == _T("loc"))
{
nglPath p(rPath.GetNodeName());
nglString n(p.GetRemovedExtension());
mFiles[n] = rPath;
}
++it;
}
return mFiles.empty();
}
示例3: CopyDirectory
bool ProjectGenerator::CopyDirectory(const nglPath& targetPath, const nglPath& srcpath)
{
// create folder
if (!targetPath.Create())
{
nglString msg;
msg.Format(_T("creating target folder '%ls'"), targetPath.GetChars());
return MsgError(msg);
}
std::list<nglPath> children;
srcpath.GetChildren(&children);
std::list<nglPath>::iterator it;
for (it = children.begin(); it != children.end(); ++it)
{
const nglPath& srcpath = *it;
if (!srcpath.IsLeaf())
continue;
nglPath dstpath = targetPath;
dstpath += srcpath.GetNodeName();
nglString contents;
nglIStream* piFile = srcpath.OpenRead();
if (!piFile)
{
nglString msg;
msg.Format(_T("opening for reading input file '%ls'"), srcpath.GetChars());
return MsgError(msg);
}
nglOStream* poFile = dstpath.OpenWrite(false);
if (!poFile)
{
nglString msg;
msg.Format(_T("opening for writing output file '%ls'"), dstpath.GetChars());
return MsgError(msg);
}
piFile->PipeTo(*poFile);
delete poFile;
delete piFile;
NGL_OUT(_T("nui project generator : created file '%ls'\n"), dstpath.GetChars());
}
return true;
}
示例4: DumpIncluder
void Generator::DumpIncluder(const nglPath& rootSource, const nglPath& pngSource,const nglPath& codeSource, const nglPath& HincluderPath, const nglPath& CPPincluderPath, nglString& HincluderStr, nglString& CPPincluderStr)
{
std::list<nglPath> children;
std::list<nglPath>::iterator it;
pngSource.GetChildren(&children);
for (it = children.begin(); it != children.end(); ++it)
{
nglPath child = *it;
if (!child.IsLeaf())
{
// recurs.
DumpIncluder(rootSource, child, codeSource, HincluderPath, CPPincluderPath, HincluderStr, CPPincluderStr);
continue;
}
if (child.GetExtension().Compare(_T("png"), false))
continue;
nglString node = child.GetPathName();
node.DeleteLeft(rootSource.GetPathName().GetLength()+1);
node.DeleteRight(nglPath(node).GetExtension().GetLength() +1);
nglPath HdestPath = codeSource + nglPath(node);
nglPath CPPdestPath = codeSource + nglPath(node);
HdestPath = nglPath(HdestPath.GetPathName() + _T(".h"));
CPPdestPath = nglPath(CPPdestPath.GetPathName() + _T(".cpp"));
HdestPath.MakeRelativeTo(HincluderPath.GetParent());
CPPdestPath.MakeRelativeTo(CPPincluderPath.GetParent());
nglString tmp;
tmp.Format(_T("#include \"%ls\"\n"), HdestPath.GetChars());
HincluderStr.Append(tmp);
tmp.Format(_T("#include \"%ls\"\n"), CPPdestPath.GetChars());
CPPincluderStr.Append(tmp);
}
}
示例5: ParsePngFiles
void Generator::ParsePngFiles(const nglPath& rootSource, const nglPath& pngSource, const nglPath& codeSource)
{
std::list<nglPath> children;
pngSource.GetChildren(&children);
std::list<nglPath>::iterator it;
for (it = children.begin(); it != children.end(); ++it)
{
const nglPath& child = *it;
if (!child.IsLeaf())
{
// recurs.
ParsePngFiles(rootSource, child, codeSource);
continue;
}
if (child.GetExtension().Compare(_T("png"), false))
continue;
nglString node = child.GetPathName();
node.DeleteLeft(rootSource.GetPathName().GetLength()+1);
node.DeleteRight(nglPath(node).GetExtension().GetLength() +1);
nglPath destPath = codeSource + nglPath(node);
NGL_OUT(_T("path '%ls', node '%ls' => destPath '%ls'\n"), child.GetChars(), node.GetChars(), destPath.GetChars());
nglPath destDir = destPath.GetParent();
if (!destDir.Exists())
destDir.Create(true);
// and call the generator tool to create .cpp and .h files
nglString cmd;
nglString space(_T(" "));
cmd.Append(mTool).Append(_T(" ")).Append(child.GetChars()).Append(_T(" ")).Append(destPath.GetChars());
NGL_OUT(_T("command : %ls\n"), cmd.GetChars());
system(cmd.GetStdString().c_str());
}
}
示例6: PopulateFiles
// nuiList path management helper:
bool nuiList::PopulateFiles(const nglPath& rPath)
{
list<nglPath> FileList;
rPath.GetChildren(&FileList);
list<nglPath>::iterator it;
list<nglPath>::iterator end = FileList.end();
for (it = FileList.begin(); it != end; ++it)
{
if ((*it).IsLeaf())
{
nuiLabel* pLabel = new nuiLabel((*it).GetNodeName());
pLabel->SetProperty(_T("Path"),(*it).GetAbsolutePath().GetPathName());
AddChild(pLabel);
}
}
return true;
}
示例7: Populate
bool nuiList::Populate(const nglPath& rPath, bool Files, bool Dirs)
{
list<nglPath> FileList;
rPath.GetChildren(&FileList);
list<nglPath>::iterator it;
list<nglPath>::iterator end = FileList.end();
if (Dirs)
{
for (it = FileList.begin(); it != end; ++it)
{
if (!(*it).IsLeaf())
{
nuiLabel* pLabel = new nuiLabel(_T("[ ")+(*it).GetNodeName()+_T(" ]"));
pLabel->SetProperty(_T("Path"),(*it).GetAbsolutePath().GetPathName());
AddChild(pLabel);
}
}
}
if (Files)
{
for (it = FileList.begin(); it != end; ++it)
{
if ((*it).IsLeaf())
{
nuiLabel* pLabel = new nuiLabel((*it).GetNodeName());
pLabel->SetProperty(_T("Path"),(*it).GetAbsolutePath().GetPathName());
AddChild(pLabel);
}
}
}
SetProperty(_T("Path"),rPath.GetAbsolutePath().GetPathName());
return true;
}
示例8: GetAllImages
static void GetAllImages(std::vector<AtlasElem>& rElements, const nglPath& rPath, int32 MaxTextureSize, int32 ForceAtlasSize, bool AutoTrim)
{
std::set<nglPath> childrenset;
{
std::list<nglPath> children;
rPath.GetChildren(&children);
std::list<nglPath>::iterator it = children.begin();
std::list<nglPath>::iterator end = children.end();
while (it != end)
{
const nglPath& p(*it);
if (p.IsLeaf())
{
nglString path(p.GetRemovedExtension());
if (nuiGetScaleFactor() > 1)
{
nglString ext(p.GetExtension());
nglString res(path);
res.Add(_T("@2x.")).Add(ext);
nglPath pp = res;
if (pp.Exists() && pp.IsLeaf()) // Does the retina version exists?
{
// Yes, add it instead of the normal version
childrenset.insert(pp);
}
else
{
// No, add the normal version
childrenset.insert(p);
}
}
else if (path.GetRight(3) == _T("@2x"))
{
// Skip this retina texture as we are not on a retina device...
}
else
{
// Normal texture on non retina device
childrenset.insert(p);
}
}
else
{
// Descend the path:
GetAllImages(rElements, *it, MaxTextureSize, ForceAtlasSize, AutoTrim);
}
++it;
}
}
// Now try to open the images:
std::set<nglPath>::iterator it = childrenset.begin();
std::set<nglPath>::iterator end = childrenset.end();
while (it != end)
{
nglPath p(*it);
nglImageInfo info;
bool res = nglImage::GetImageInfo(info, p);
// Try to load the image
if (res && info.mWidth <= MaxTextureSize && info.mHeight <= MaxTextureSize)
{
nglImage* pImage = new nglImage(p);
if (AutoTrim)
{
nglImagePixelFormat format = pImage->GetPixelFormat();
if (format == eImagePixelRGBA ||
format == eImagePixelAlpha ||
format == eImagePixelLumA)
{
int32 x, y;
nglImage* pTrimmed = pImage->Trim(x, y);
if (1)
{
int32 ow, oh, nw, nh;
ow = pImage->GetWidth();
oh = pImage->GetHeight();
nw = pTrimmed->GetWidth();
nh = pTrimmed->GetHeight();
float gain = (float)(ow*oh - nw*nh) / (float)(ow*oh);
NGL_OUT(_T("Trim %s\n\t\t%d x %d -> %d x %d (%d pixels -> %2.2fpcf gained)\n"), p.GetChars(), ow, oh, nw, nh, ow*oh - nw*nh, 100.0 * gain);
}
delete pImage;
pImage = pTrimmed;
}
}
AtlasElem elem;
elem.mPath = p;
elem.mpImage = pImage;
rElements.push_back(elem);
//.........这里部分代码省略.........