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


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

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


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

示例1: DefineTextX

/*
========================
idSWF::DefineTextX
========================
*/
void idSWF::DefineTextX( idSWFBitStream & bitstream, bool rgba ) {
	uint16 characterID = bitstream.ReadU16();
	idSWFDictionaryEntry * entry = AddDictionaryEntry( characterID, SWF_DICT_TEXT );
	if ( entry == NULL ) {
		return;
	}
	idSWFText * text = entry->text;

	bitstream.ReadRect( text->bounds );
	bitstream.ReadMatrix( text->matrix );

	uint8 glyphBits = bitstream.ReadU8();
	uint8 advanceBits = bitstream.ReadU8();

	while ( true ) {
		uint8 flags = bitstream.ReadU8();
		if ( flags == 0 ) {
			break;
		}
		idSWFTextRecord & textRecord = text->textRecords.Alloc();

		if ( flags & BIT( 3 ) ) {
			textRecord.fontID = bitstream.ReadU16();
		}
		if ( flags & BIT( 2 ) ) {
			if ( rgba ) {
				bitstream.ReadColorRGBA( textRecord.color );
			} else {
				bitstream.ReadColorRGB( textRecord.color );
			}
		}
		if ( flags & BIT( 0 ) ) {
			textRecord.xOffset = bitstream.ReadS16();
		}
		if ( flags & BIT( 1 ) ) {
			textRecord.yOffset = bitstream.ReadS16();
		}
		if ( flags & BIT( 3 ) ) {
			textRecord.textHeight = bitstream.ReadU16();
		}
		textRecord.firstGlyph = text->glyphs.Num();
		textRecord.numGlyphs = bitstream.ReadU8();
		for ( int i = 0; i < textRecord.numGlyphs; i++ ) {
			swfGlyphEntry_t & glyph = text->glyphs.Alloc();
			glyph.index = bitstream.ReadU( glyphBits );
			glyph.advance = bitstream.ReadS( advanceBits );
		}
	};
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:54,代码来源:SWF_Text.cpp

示例2: ParseShapes

/*
========================
idSWFShapeParser::ParseShapes
========================
*/
void idSWFShapeParser::ParseShapes( idSWFBitStream& bitstream1, idSWFBitStream* bitstream2, bool swap )
{
	int32 pen1X = 0;
	int32 pen1Y = 0;
	int32 pen2X = 0;
	int32 pen2Y = 0;
	
	uint8 fillStyle0 = 0;
	uint8 fillStyle1 = 0;
	uint8 lineStyle = 0;
	
	uint16 baseFillStyle = 0;
	uint16 baseLineStyle = 0;
	
	uint8 numBits = bitstream1.ReadU8();
	uint8 numFillBits1 = numBits >> 4;
	uint8 numLineBits1 = numBits & 0xF;
	
	uint8 numFillBits2 = 0;
	uint8 numLineBits2 = 0;
	
	if( bitstream2 )
	{
		numBits = bitstream2->ReadU8();
		numFillBits2 = numBits >> 4;
		numLineBits2 = numBits & 0xF;
	}
	
	while( true )
	{
		if( !bitstream1.ReadBool() )
		{
			bool stateNewStyles = bitstream1.ReadBool();
			bool stateLineStyle = bitstream1.ReadBool();
			bool stateFillStyle1 = bitstream1.ReadBool();
			bool stateFillStyle0 = bitstream1.ReadBool();
			bool stateMoveTo = bitstream1.ReadBool();
			if( ( stateNewStyles || stateLineStyle || stateFillStyle1 || stateFillStyle0 || stateMoveTo ) == false )
			{
				// end record
				if( bitstream2 )
				{
					uint8 flags = bitstream2->ReadU( 6 );
					if( flags != 0 )
					{
						idLib::Warning( "idSWFShapeParser: morph stream 1 ends before 2" );
						break;
					}
				}
				break;
			}
			if( stateMoveTo )
			{
				uint8 moveBits = bitstream1.ReadU( 5 );
				pen1X = bitstream1.ReadS( moveBits );
				pen1Y = bitstream1.ReadS( moveBits );
			}
			if( stateFillStyle0 )
			{
				fillStyle0 = bitstream1.ReadU( numFillBits1 );
			}
			if( stateFillStyle1 )
			{
				fillStyle1 = bitstream1.ReadU( numFillBits1 );
			}
			if( stateLineStyle )
			{
				lineStyle = bitstream1.ReadU( numLineBits1 );
			}
			if( stateNewStyles )
			{
				baseFillStyle = fillDraws.Num();
				baseLineStyle = lineDraws.Num();
				ReadFillStyle( bitstream1 );
				numBits = bitstream1.ReadU8();
				numFillBits1 = numBits >> 4;
				numLineBits1 = numBits & 0xF;
			}
			if( bitstream2 )
			{
				bool isEdge = bitstream2->ReadBool();
				if( isEdge )
				{
					idLib::Warning( "idSWFShapeParser: morph stream 1 defines style change, but stream 2 does not" );
					break;
				}
				bool stateNewStyles = bitstream2->ReadBool();
				bool stateLineStyle = bitstream2->ReadBool();
				bool stateFillStyle1 = bitstream2->ReadBool();
				bool stateFillStyle0 = bitstream2->ReadBool();
				bool stateMoveTo = bitstream2->ReadBool();
				if( stateMoveTo )
				{
					uint8 moveBits = bitstream2->ReadU( 5 );
					pen2X = bitstream2->ReadS( moveBits );
//.........这里部分代码省略.........
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:101,代码来源:SWF_ShapeParser.cpp


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