本文整理汇总了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;
}
示例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;
}
示例3: resetTunableVariant
void VariantTuner::resetTunableVariant()
{
Entity* rootEntity = GetBaseApp()->GetEntityRoot();
VariantChangerComponent* varChanger = dynamic_cast<VariantChangerComponent*>(rootEntity->GetComponentByName("VariantChanger"));
if (varChanger != NULL)
{
varChanger->SetChangeableVariant(NULL);
}
}
示例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() );
}
}
示例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);
}