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


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

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


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

示例1: FindDisplayEntry

/*
========================
idSWFSpriteInstance::PlaceObject2
========================
*/
void idSWFSpriteInstance::PlaceObject2( idSWFBitStream & bitstream ) {
	c_PlaceObject2++;

	uint64 flags = bitstream.ReadU8();
	int depth = bitstream.ReadU16();

	int characterID = -1;
	if ( ( flags & PlaceFlagHasCharacter ) != 0 ) {
		characterID = bitstream.ReadU16();
	}

	swfDisplayEntry_t * display = NULL;

	if ( ( flags & PlaceFlagMove ) != 0 ) {
		// modify an existing entry
		display = FindDisplayEntry( depth );
		if ( display == NULL ) {
			idLib::Warning( "PlaceObject2: trying to modify entry %d, which doesn't exist", depth );
			return;
		}
		if ( characterID >= 0 ) {
			// We are very picky about what kind of objects can change characters
			// Shapes can become other shapes, but sprites can never change
			if ( display->spriteInstance || display->textInstance ) {
				idLib::Warning( "PlaceObject2: Trying to change the character of a sprite after it's been created" );
				return;
			}
			idSWFDictionaryEntry * dictEntry = sprite->swf->FindDictionaryEntry( characterID );
			if ( dictEntry != NULL ) {
				if ( dictEntry->type == SWF_DICT_SPRITE || dictEntry->type == SWF_DICT_EDITTEXT ) {
					idLib::Warning( "PlaceObject2: Trying to change the character of a shape to a sprite" );
					return;
				}
			}
			display->characterID = characterID;
		}
	} else {
		if ( characterID < 0 ) {
			idLib::Warning( "PlaceObject2: Trying to create a new object without a character" );
			return;
		}
		// create a new entry
		display = AddDisplayEntry( depth, characterID );
		if ( display == NULL ) {
			idLib::Warning( "PlaceObject2: trying to create a new entry at %d, but an item already exists there", depth );
			return;
		}
	}
	if ( ( flags & PlaceFlagHasMatrix ) != 0 ) {
		bitstream.ReadMatrix( display->matrix );
	}
	if ( ( flags & PlaceFlagHasColorTransform ) != 0 ) {
		bitstream.ReadColorXFormRGBA( display->cxf );
	}
	if ( ( flags & PlaceFlagHasRatio ) != 0 ) {
		display->ratio = bitstream.ReadU16() * ( 1.0f / 65535.0f );
	}
	if ( ( flags & PlaceFlagHasName ) != 0 ) {
		idStr name = bitstream.ReadString();
		if ( display->spriteInstance ) {
			display->spriteInstance->name = name;
			scriptObject->Set( name, display->spriteInstance->GetScriptObject() );
		} else if ( display->textInstance ) {
			scriptObject->Set( name, display->textInstance->GetScriptObject() );
		}
	}
	if ( ( flags & PlaceFlagHasClipDepth ) != 0 ) {
		display->clipDepth = bitstream.ReadU16();
	}
	if ( ( flags & PlaceFlagHasClipActions ) != 0 ) {
		// FIXME: clip actions
	}
}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:78,代码来源:SWF_PlaceObject.cpp


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