本文整理汇总了C++中common::ArchiveMemberPtr::createReadStream方法的典型用法代码示例。如果您正苦于以下问题:C++ ArchiveMemberPtr::createReadStream方法的具体用法?C++ ArchiveMemberPtr::createReadStream怎么用?C++ ArchiveMemberPtr::createReadStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::ArchiveMemberPtr
的用法示例。
在下文中一共展示了ArchiveMemberPtr::createReadStream方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
/**********************************************************
* Theme setup/initialization
*********************************************************/
bool ThemeEngine::init() {
// reset everything and reload the graphics
_initOk = false;
_overlayFormat = _system->getOverlayFormat();
setGraphicsMode(_graphicsMode);
if (_screen.pixels && _backBuffer.pixels) {
_initOk = true;
}
// TODO: Instead of hard coding the font here, it should be possible
// to specify the fonts to be used for each resolution in the theme XML.
if (_screen.w >= 400 && _screen.h >= 300) {
_font = FontMan.getFontByUsage(Graphics::FontManager::kBigGUIFont);
} else {
_font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
}
// Try to create a Common::Archive with the files of the theme.
if (!_themeArchive && !_themeFile.empty()) {
Common::FSNode node(_themeFile);
if (node.isDirectory()) {
_themeArchive = new Common::FSDirectory(node);
} else if (_themeFile.matchString("*.zip", true)) {
// TODO: Also use "node" directly?
// Look for the zip file via SearchMan
Common::ArchiveMemberPtr member = SearchMan.getMember(_themeFile);
if (member) {
_themeArchive = Common::makeZipArchive(member->createReadStream());
if (!_themeArchive) {
warning("Failed to open Zip archive '%s'.", member->getDisplayName().c_str());
}
} else {
_themeArchive = Common::makeZipArchive(node);
if (!_themeArchive) {
warning("Failed to open Zip archive '%s'.", node.getPath().c_str());
}
}
}
}
// Load the theme
// We pass the theme file here by default, so the user will
// have a descriptive error message. The only exception will
// be the builtin theme which has no filename.
loadTheme(_themeFile.empty() ? _themeId : _themeFile);
return ready();
}
示例2:
static GLES8888Texture *loadBuiltinTexture(const char *filename) {
Common::ArchiveMemberPtr member = SearchMan.getMember(filename);
Common::SeekableReadStream *str = member->createReadStream();
Graphics::TGADecoder dec;
dec.loadStream(*str);
const void *pixels = dec.getSurface()->getPixels();
GLES8888Texture *ret = new GLES8888Texture();
uint16 w = dec.getSurface()->w;
uint16 h = dec.getSurface()->h;
uint16 pitch = dec.getSurface()->pitch;
ret->allocBuffer(w, h);
ret->updateBuffer(0, 0, w, h, pixels, pitch);
delete str;
return ret;
}
示例3:
Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &filename) {
Common::String upcName = filename;
upcName.toUppercase();
Common::SeekableReadStream *file = nullptr;
// correct slashes
for (uint32 i = 0; i < upcName.size(); i++) {
if (upcName[(int32)i] == '/') {
upcName.setChar('\\', (uint32)i);
}
}
Common::ArchiveMemberPtr entry = _packages.getMember(upcName);
if (!entry) {
return nullptr;
}
file = entry->createReadStream();
return file;
}
示例4:
Common::SeekableReadStream *BaseFileManager::openPkgFile(const Common::String &filename) {
Common::String upcName = filename;
upcName.toUppercase();
Common::SeekableReadStream *file = NULL;
char fileName[MAX_PATH_LENGTH];
strcpy(fileName, upcName.c_str());
// correct slashes
for (uint32 i = 0; i < upcName.size(); i++) {
if (upcName[(int32)i] == '/') {
upcName.setChar('\\', (uint32)i);
}
}
Common::ArchiveMemberPtr entry = _packages.getMember(upcName);
if (!entry) {
return NULL;
}
file = entry->createReadStream();
return file;
}