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


C++ idSWFBitStream::ReadData方法代码示例

本文整理汇总了C++中idSWFBitStream::ReadData方法的典型用法代码示例。如果您正苦于以下问题:C++ idSWFBitStream::ReadData方法的具体用法?C++ idSWFBitStream::ReadData怎么用?C++ idSWFBitStream::ReadData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在idSWFBitStream的用法示例。


在下文中一共展示了idSWFBitStream::ReadData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ParseMorph

/*
========================
idSWFShapeParser::ParseMorph
========================
*/
void idSWFShapeParser::ParseMorph( idSWFBitStream& bitstream, idSWFShape& shape )
{
	extendedCount = true;
	lineStyle2 = false;
	rgba = true;
	morph = true;
	
	bitstream.ReadRect( shape.startBounds );
	bitstream.ReadRect( shape.endBounds );
	
	uint32 offset = bitstream.ReadU32();
	
	// offset is the byte offset from the current read position to the 'endShape' record
	// we read the entire block into 'bitstream1' which moves the read pointer of 'bitstream'
	// to the start of the 'endShape' record
	
	idSWFBitStream bitstream1;
	bitstream1.Load( ( byte* )bitstream.ReadData( offset ), offset, false );
	
	ReadFillStyle( bitstream1 );
	ParseShapes( bitstream1, &bitstream, true );
	TriangulateSoup( shape );
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:28,代码来源:SWF_ShapeParser.cpp

示例2: offsetStream

/*
========================
idSWF::DefineFont2
========================
*/
void idSWF::DefineFont2( idSWFBitStream & bitstream ) {
	uint16 characterID = bitstream.ReadU16();
	idSWFDictionaryEntry * entry = AddDictionaryEntry( characterID, SWF_DICT_FONT );
	if ( entry == NULL ) {
		return;
	}
	uint8 flags = bitstream.ReadU8();
	uint8 language = bitstream.ReadU8();

	char fontName[257];
	uint8 fontNameLength = bitstream.ReadU8();
	memcpy( fontName, bitstream.ReadData( fontNameLength ), fontNameLength );
	fontName[ fontNameLength ] = 0;

	entry->font->fontID = renderSystem->RegisterFont( fontName );

	uint16 numGlyphs = bitstream.ReadU16();
	entry->font->glyphs.SetNum( numGlyphs );

	if ( flags & BIT( 3 ) ) {
		// 32 bit offsets
		uint32 offsetTableSize = ( numGlyphs + 1 ) * 4;
		idSWFBitStream offsetStream( bitstream.ReadData( offsetTableSize ), offsetTableSize, false );
		if ( offsetStream.ReadU32() != offsetTableSize ) {
			idLib::Warning( "idSWF::DefineFont2: first glyph offset != offsetTableSize" );
			return;
		}
		uint32 previousOffset = offsetTableSize;
		for ( int i = 0; i < numGlyphs; i++ ) {
			uint32 nextOffset = offsetStream.ReadU32();
			uint32 shapeSize = nextOffset - previousOffset;
			previousOffset = nextOffset;
			idSWFBitStream shapeStream( bitstream.ReadData( shapeSize ), shapeSize, false );
			idSWFShapeParser swfShapeParser;
			swfShapeParser.ParseFont( shapeStream, entry->font->glyphs[i] );
		}
	} else {
		// 16 bit offsets
		uint16 offsetTableSize = ( numGlyphs + 1 ) * 2;
		idSWFBitStream offsetStream( bitstream.ReadData( offsetTableSize ), offsetTableSize, false );
		if ( offsetStream.ReadU16() != offsetTableSize ) {
			idLib::Warning( "idSWF::DefineFont2: first glyph offset != offsetTableSize" );
			return;
		}
		uint16 previousOffset = offsetTableSize;
		for ( int i = 0; i < numGlyphs; i++ ) {
			uint16 nextOffset = offsetStream.ReadU16();
			uint16 shapeSize = nextOffset - previousOffset;
			previousOffset = nextOffset;
			idSWFBitStream shapeStream( bitstream.ReadData( shapeSize ), shapeSize, false );
			idSWFShapeParser swfShapeParser;
			swfShapeParser.ParseFont( shapeStream, entry->font->glyphs[i] );
		}
	}
	if ( flags & BIT( 2 ) ) {
		// 16 bit codes
		for ( int i = 0; i < numGlyphs; i++ ) {
			entry->font->glyphs[i].code = bitstream.ReadU16();
		}
	} else {
		// 8 bit codes
		for ( int i = 0; i < numGlyphs; i++ ) {
			entry->font->glyphs[i].code = bitstream.ReadU8();
		}
	}
	if ( flags & BIT( 7 ) ) {
		entry->font->ascent = bitstream.ReadS16();
		entry->font->descent = bitstream.ReadS16();
		entry->font->leading = bitstream.ReadS16();
		for ( int i = 0; i < numGlyphs; i++ ) {
			entry->font->glyphs[i].advance = bitstream.ReadS16();
		}
		for ( int i = 0; i < numGlyphs; i++ ) {
			swfRect_t ignored;
			bitstream.ReadRect( ignored );
		}
		uint16 kearningCount = bitstream.ReadU16();
		if ( flags & BIT( 2 ) ) {
			for ( int i = 0; i < kearningCount; i++ ) {
				uint16 code1 = bitstream.ReadU16();
				uint16 code2 = bitstream.ReadU16();
				int16 adjustment = bitstream.ReadS16();
			}
		} else {
			for ( int i = 0; i < kearningCount; i++ ) {
				uint16 code1 = bitstream.ReadU8();
				uint16 code2 = bitstream.ReadU8();
				int16 adjustment = bitstream.ReadS16();
			}
		}
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:97,代码来源:SWF_Text.cpp

示例3: DoAction

/*
========================
idSWFSpriteInstance::DoAction
========================
*/
void idSWFSpriteInstance::DoAction( idSWFBitStream & bitstream ) {
	swfAction_t & action = actions.Alloc();
	action.data = bitstream.ReadData( bitstream.Length() );
	action.dataLength = bitstream.Length();
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:10,代码来源:SWF_SpriteInstance.cpp


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