本文整理汇总了C++中PackageManager::getAbsolutePath方法的典型用法代码示例。如果您正苦于以下问题:C++ PackageManager::getAbsolutePath方法的具体用法?C++ PackageManager::getAbsolutePath怎么用?C++ PackageManager::getAbsolutePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageManager
的用法示例。
在下文中一共展示了PackageManager::getAbsolutePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parserCallback_font
bool FontResource::parserCallback_font(ParserNode *node) {
// Get the attributes of the font
Common::String bitmapFilename = node->values["bitmap"];
if (!parseIntegerKey(node->values["lineheight"], 1, &_lineHeight)) {
warning("Illegal or missing lineheight attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
getFileName().c_str(), DEFAULT_LINEHEIGHT);
_lineHeight = DEFAULT_LINEHEIGHT;
}
if (!parseIntegerKey(node->values["gap"], 1, &_gapWidth)) {
warning("Illegal or missing gap attribute in <font> tag in \"%s\". Assuming default (\"%d\").",
getFileName().c_str(), DEFAULT_GAPWIDTH);
_gapWidth = DEFAULT_GAPWIDTH;
}
// Get a reference to the package manager
assert(_pKernel);
PackageManager *pPackage = _pKernel->getPackage();
assert(pPackage);
// Get the full path and filename for the bitmap resource
_bitmapFileName = pPackage->getAbsolutePath(bitmapFilename);
if (_bitmapFileName == "") {
error("Image file \"%s\" was specified in <font> tag of \"%s\" but could not be found.",
_bitmapFileName.c_str(), getFileName().c_str());
}
// Pre-cache the resource
if (!_pKernel->getResourceManager()->precacheResource(_bitmapFileName)) {
error("Could not precache \"%s\".", _bitmapFileName.c_str());
}
return true;
}
示例2:
Resource::Resource(const Common::String &fileName, RESOURCE_TYPES type) :
_type(type),
_refCount(0) {
PackageManager *pPM = Kernel::getInstance()->getPackage();
assert(pPM);
_fileName = pPM->getAbsolutePath(fileName);
}
示例3: executeFile
bool LuaScriptEngine::executeFile(const Common::String &fileName) {
#ifdef DEBUG
int __startStackDepth = lua_gettop(_state);
#endif
debug(2, "LuaScriptEngine::executeFile(%s)", fileName.c_str());
// Get a pointer to the package manager
PackageManager *pPackage = Kernel::getInstance()->getPackage();
assert(pPackage);
// File read
uint fileSize;
byte *fileData = pPackage->getFile(fileName, &fileSize);
if (!fileData) {
error("Couldn't read \"%s\".", fileName.c_str());
#ifdef DEBUG
assert(__startStackDepth == lua_gettop(_state));
#endif
return false;
}
// Run the file content
if (!executeBuffer(fileData, fileSize, "@" + pPackage->getAbsolutePath(fileName))) {
// Release file buffer
delete[] fileData;
#ifdef DEBUG
assert(__startStackDepth == lua_gettop(_state));
#endif
return false;
}
// Release file buffer
delete[] fileData;
#ifdef DEBUG
assert(__startStackDepth == lua_gettop(_state));
#endif
return true;
}