当前位置: 首页>>代码示例>>C++>>正文


C++ MemoryReadStream::readUint16LE方法代码示例

本文整理汇总了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;
}
开发者ID:AReim1982,项目名称:scummvm,代码行数:13,代码来源:resource.cpp

示例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;

}
开发者ID:AReim1982,项目名称:scummvm,代码行数:38,代码来源:resource.cpp


注:本文中的common::MemoryReadStream::readUint16LE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。