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


C++ Entity::GetComponentByName方法代码示例

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


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

示例1: GameCreate

Entity* GameCreate( Entity* pParentEnt )
{
	Config* config = Config::GetInstance();
	
	GetApp()->setContinueBtn( true );

	char path[256];
	sprintf( path, "%s%s", GetApp()->getResourceInstance()->getItem( GetApp()->getResolutionType(), RES_TYPE_MENU, RES_ID_NONE ).c_str(), s_gameMenuXml );

	XMLMenu* parser = new XMLMenu( path, pParentEnt, &GameOnSelect, config->getLangPack() );
	parser->Read();
	Entity* pBG = parser->createEntities();
	delete parser;

	Entity* pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGE_GAMEOVER_SPLASH );
	if( pEnt )
	{
		pEnt->GetVar( "visible" )->Set( uint32( 0 ) );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_DOWN );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_LEFT );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_RIGHT );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	pEnt = GetEntityRoot()->GetEntityByName( GUI_IMAGEBUTTON_GAMEPLAY_ROTATE );
	if( pEnt )
	{
		 pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}

	GetApp()->setGame( true );

	FadeInEntity( pBG, true, 1000 );

	config->FreeInstance();

	return pBG;
}
开发者ID:maximbilan,项目名称:tblock,代码行数:49,代码来源:GUI_Game.cpp

示例2: SoundCreate

Entity* SoundCreate( Entity* pParentEnt )
{
	GameState::GetCurrentState()->SetSubState( GS_Menu::k_substate_none );

	char path[256];
	sprintf( path, "%s%s", GetApp()->getResourceInstance()->getItem( GetApp()->getResolutionType(), RES_TYPE_MENU, RES_ID_NONE ).c_str(), s_soundMenuXml );

	Config* config = Config::GetInstance();

	XMLMenu* parser = new XMLMenu( path, pParentEnt, &SoundOnSelect, config->getLangPack() );
	parser->Read();
	Entity* pBG = parser->createEntities();
	delete parser;

	std::string cbEffects = GUI_CHECKBOX_CHECKBOX_EFFECTS;
	std::string cbMusic = GUI_CHECKBOX_CHECKBOX_MUSIC;
	std::string cbVibration = GUI_CHECKBOX_CHECKBOX_VIBRATION;
		
	Entity *pEnt = GetEntityRoot()->GetEntityByName( cbEffects );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getSoundEffects(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	pEnt = GetEntityRoot()->GetEntityByName( cbMusic );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getMusic(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	pEnt = GetEntityRoot()->GetEntityByName( cbVibration );
	if( pEnt )
	{
		SetCheckBoxChecked( pEnt, !config->getVibration(), false );
		pEnt->GetComponentByName( "Button2D" )->GetVar( "repeatDelayMS" )->Set( uint32( 0 ) );
	}
	
	FadeInEntity( pBG, true, 1000 );

	config->FreeInstance();

	return pBG;
}
开发者ID:maximbilan,项目名称:tblock,代码行数:45,代码来源:GUI_Sound.cpp

示例3: resetTunableVariant

void VariantTuner::resetTunableVariant()
{
	Entity* rootEntity = GetBaseApp()->GetEntityRoot();
	VariantChangerComponent* varChanger = dynamic_cast<VariantChangerComponent*>(rootEntity->GetComponentByName("VariantChanger"));

	if (varChanger != NULL)
	{
		varChanger->SetChangeableVariant(NULL);
	}
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:10,代码来源:VariantTuner.cpp

示例4: UpdateState

void GS_GamePlay::UpdateState( int frameTime )
{
	Entity* pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_LEVEL_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getLevel() );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_SCORE_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getScore() );
	}

	pEnt = GetEntityRoot()->GetEntityByName( GUI_TEXT_LINES_LABEL_BOX );
	if( pEnt )
	{
		pEnt->GetComponentByName( "TextRender" )->GetVar( "text" )->Set( m_tetris->getLines() );
	}
}
开发者ID:maximbilan,项目名称:tblock,代码行数:20,代码来源:GS_GamePlay.cpp

示例5: setTunableVariant

void VariantTuner::setTunableVariant(Variant& var, const Variant& step)
{
	Entity* rootEntity = GetBaseApp()->GetEntityRoot();
	VariantChangerComponent* varChanger = dynamic_cast<VariantChangerComponent*>(rootEntity->GetComponentByName("VariantChanger"));

	if (varChanger == NULL)
	{
		varChanger = new VariantChangerComponent;
		rootEntity->AddComponent(varChanger);
	}

	varChanger->SetChangeableVariant(&var);

	varChanger->GetVar("step")->Reset();
	varChanger->GetVar("step")->Set(step);
}
开发者ID:Boerlam001,项目名称:proton_sdk_source,代码行数:16,代码来源:VariantTuner.cpp


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