本文整理汇总了C++中common::MemoryReadStream::readUint16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryReadStream::readUint16LE方法的具体用法?C++ MemoryReadStream::readUint16LE怎么用?C++ MemoryReadStream::readUint16LE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::MemoryReadStream
的用法示例。
在下文中一共展示了MemoryReadStream::readUint16LE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void MenuResource::load(byte *source, int size) {
_strings.clear();
Common::MemoryReadStream *sourceS = new Common::MemoryReadStream(source, size);
sourceS->skip(4); // skip "MENU"
uint16 count = sourceS->readUint16LE();
for (uint16 i = 0; i < count; i++) {
uint16 offs = sourceS->readUint16LE();
const char *string = (const char*)(source + offs);
_strings.push_back(string);
debug(2, "%02d: %s\n", i, string);
}
delete sourceS;
}
示例2: loadRaw
void PictureResource::loadRaw(byte *source, int size) {
// Loads a "raw" picture as used in RtZ, LGoP2, Manhole:N&E and Rodney's Funscreen
Common::MemoryReadStream *sourceS = new Common::MemoryReadStream(source, size);
_hasPalette = (sourceS->readByte() != 0);
byte cmdFlags = sourceS->readByte();
byte pixelFlags = sourceS->readByte();
byte maskFlags = sourceS->readByte();
uint16 cmdOffs = sourceS->readUint16LE();
uint16 pixelOffs = sourceS->readUint16LE();
uint16 maskOffs = sourceS->readUint16LE();
uint16 lineSize = sourceS->readUint16LE();
/*uint16 u = */sourceS->readUint16LE();
uint16 width = sourceS->readUint16LE();
uint16 height = sourceS->readUint16LE();
if (cmdFlags || pixelFlags || maskFlags) {
warning("PictureResource::loadRaw() Graphic has flags set (%d, %d, %d)", cmdFlags, pixelFlags, maskFlags);
}
_paletteColorCount = (cmdOffs - 18) / 3; // 18 = sizeof header
debug(2, "width = %d; height = %d\n", width, height);
if (_hasPalette) {
_picturePalette = new byte[_paletteColorCount * 3];
sourceS->read(_picturePalette, _paletteColorCount * 3);
}
_picture = new Graphics::Surface();
_picture->create(width, height, Graphics::PixelFormat::createFormatCLUT8());
decompressImage(source, *_picture, cmdOffs, pixelOffs, maskOffs, lineSize, cmdFlags, pixelFlags, maskFlags);
delete sourceS;
}