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


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

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


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

示例1: UpdateActiveIndexes

void RenderUpdateSystem::UpdateActiveIndexes(Entity *entity, RenderObject *object)
{
    Entity *parent;
    
    // search effective lod index
    parent = entity;
    while(NULL != parent)
    {
        LodComponent *lc = GetLodComponent(parent);
        if(NULL != lc)
        {
            object->SetLodIndex(lc->currentLod);
            break;
        }

        parent = parent->GetParent();
    }

    // search effective switch index
    parent = entity;
    while(NULL != parent)
    {
        SwitchComponent *sc = GetSwitchComponent(parent);
        if(NULL != sc)
        {
            object->SetSwitchIndex(sc->GetSwitchIndex());
            break;
        }

        parent = parent->GetParent();
    }
}
开发者ID:galek,项目名称:dava.framework,代码行数:32,代码来源:RenderUpdateSystem.cpp

示例2: SoundOnSelect

void SoundOnSelect( VariantList* pVList )
{
	Entity *pEntClicked = pVList->m_variant[1].GetEntity();

	Config* config = Config::GetInstance();

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_SOUND_BACK_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		OptionsCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_CHECKBOX_CHECKBOX_EFFECTS )
	{
		GetApp()->buttonClickSound();
		config->setSoundEffects( !config->getSoundEffects() );
		GetApp()->GetVar( "SoundEffects" )->Set( uint32(config->getSoundEffects() ) );
		config->Save();
	}

	if( pEntClicked->GetName() == GUI_CHECKBOX_CHECKBOX_MUSIC )
	{
		GetApp()->buttonClickSound();
		config->setMusic( !config->getMusic() );
		GetApp()->GetVar( "Music" )->Set( uint32( config->getMusic() ) );
		config->Save();
	}

	if( pEntClicked->GetName() == GUI_CHECKBOX_CHECKBOX_VIBRATION )
	{
		GetApp()->buttonClickSound();
		config->setVibration( !config->getVibration() );
		GetApp()->GetVar( "Vibration" )->Set( uint32( config->getVibration() ) );
		config->Save();

		if( config->getVibration() )
		{
			GetAudioManager()->Vibrate();
		}
	}

	config->FreeInstance();
}
开发者ID:maximbilan,项目名称:tblock,代码行数:45,代码来源:GUI_Sound.cpp

示例3: Update

	/**
	*Finds our parent entity and deletes it
	*
	*@param curState the current worldstate to reference during update
	*@exception thrown if we do not have a valid entity parent, or if our target Entity is not set
	*/
	void ActionDestroyEntity::Update(const Library::WorldState& curState)
	{
		//Ensure our target entity name is set
		if (mEntity == "")
		{
			throw std::exception("Our entity target cannot be unnamed!");
		}

		Scope* scope = this;
		Entity* entity = nullptr;
		bool condition = false;

		//Iterate upwards to find our containing entity
		while (!condition)
		{
			//Get the action scope above us
			scope = scope->GetParent();
			if (scope == nullptr)
			{
				throw std::exception("We do not have an Entity or ActionList parent! This is invalid.");
			}

			//Get our real parent, who is either an entity of an action list
			scope = scope->GetParent();
			if (scope == nullptr)
			{
				throw std::exception("We do not have an Entity or ActionList parent! This is invalid.");
			}

			//See if our grandparent scope is an Entity
			entity = scope->As<Entity>();

			//If our grandparent is an actionlist we need to keep iterating upwards through the heirarchy to find the containing Entity
			//Else, we can delete the entity
			if (entity != nullptr)
			{
				condition = true;
			}
		}

		//Get the scope that contains the entity
		Scope* targetParent = entity->GetParent();

		//Remove the entity from the parent scope
		if (targetParent != nullptr)
		{
			Datum* target = targetParent->Find(mEntity);
			if (target != nullptr)
			{
				Scope* scope = target->Get<Scope*>();
				scope->Orphan();
				delete scope;
				target->Set((Scope*)nullptr);
			}
		}
	}
开发者ID:CalWLee,项目名称:FIEATetris,代码行数:62,代码来源:ActionDestroyEntity.cpp

示例4: ShowSceneGraphMenu

void QSceneGraphTreeView::ShowSceneGraphMenu(const QModelIndex &index, const QPoint &point)
{
    if(!index.isValid())
    {
        return;
    }
    
    QMenu menu;
    
	// For "custom" Particles Editor nodes the "generic" ones aren't needed".
    if (sceneGraphModel->GetParticlesEditorSceneModelHelper().NeedDisplaySceneEditorPopupMenuItems(index))
    {
		SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
		LandscapesController *landsacpesController = activeScene->GetLandscapesController();

		SceneEditorScreenMain *screen = static_cast<SceneEditorScreenMain *>(UIScreenManager::Instance()->GetScreen(SCREEN_MAIN_OLD));
		EditorBodyControl *c = screen->FindCurrentBody()->bodyControl;

		bool canChangeScene = !landsacpesController->EditorLandscapeIsActive() && !c->LandscapeEditorActive();
		if(!canChangeScene)
			return;



		AddActionToMenu(&menu, QString("Look at Object"), new CommandLockAtObject());
		AddActionToMenu(&menu, QString("Remove Object"), new CommandRemoveSceneNode());
	
		AddActionToMenu(&menu, QString("Debug Flags"), new CommandDebugFlags());
    
		Entity *node = static_cast<Entity *>(sceneGraphModel->ItemData(index));
		if (node)
		{
            SceneData *activeScene = SceneDataManager::Instance()->SceneGetActive();
            if(node->GetParent() == activeScene->GetScene())
            {
                KeyedArchive *properties = node->GetCustomProperties();
                if (properties && properties->IsKeyExists(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER)))
                {
                    String filePathname = properties->GetString(String(ResourceEditor::EDITOR_REFERENCE_TO_OWNER));

                    AddActionToMenu(&menu, QString("Remove Root Nodes"), new CommandRemoveRootNodes());
				}
			}
			FilePath filePathForSaveAs(activeScene->GetScenePathname());
			AddActionToMenu(&menu, QString("Save Scene As"), new CommandSaveSpecifiedScene(node, filePathForSaveAs));
		}
	}
	
	// For "custom" Particles Editor nodes the "generic" ones aren't needed".
    // We might need more menu items/actions for Particles Editor.
    sceneGraphModel->GetParticlesEditorSceneModelHelper().AddPopupMenuItems(menu, index);

    connect(&menu, SIGNAL(triggered(QAction *)), this, SLOT(SceneGraphMenuTriggered(QAction *)));
    menu.exec(point);
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:55,代码来源:QSceneGraphTreeView.cpp

示例5: OnCreateButtonClicked

void AddSkyboxDialog::OnCreateButtonClicked()
{
	if(editorScene)
	{
		Entity* skyboxEntity = editorScene->skyboxSystem->AddSkybox();
        skyboxEntity->Retain();

		skyboxEntity->GetParent()->RemoveNode(skyboxEntity);
        editorScene->Exec(new EntityAddCommand(skyboxEntity, editorScene)); //To enable Ctrl+Z operation
        skyboxEntity->Release();
	}
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:12,代码来源:AddSkyboxDialog.cpp

示例6: ValidateScene

void SceneValidator::ValidateScene(Scene *scene, const DAVA::FilePath &scenePath, Set<String> &errorsLog)
{
    if(scene) 
    {
		DAVA::String tmp = scenePath.GetAbsolutePathname();
		size_t pos = tmp.find("/Data");
		if(pos != String::npos)
		{
			SetPathForChecking(tmp.substr(0, pos + 1));
		}

        ValidateSceneNode(scene, errorsLog);

        for (Set<Entity*>::iterator it = emptyNodesForDeletion.begin(); it != emptyNodesForDeletion.end(); ++it)
        {
            Entity * node = *it;
            if (node->GetParent())
            {
                node->GetParent()->RemoveNode(node);
            }
        }
        

		for (Set<Entity *>::iterator it = emptyNodesForDeletion.begin(); it != emptyNodesForDeletion.end(); ++it)
		{
			Entity *node = *it;
			SafeRelease(node);
		}

        emptyNodesForDeletion.clear();
    }
    else 
    {
        errorsLog.insert(String("Scene in NULL!"));
    }
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:36,代码来源:SceneValidator.cpp

示例7: LanguageOnSelect

void LanguageOnSelect( VariantList *pVList )
{
	Entity *pEntClicked = pVList->m_variant[1].GetEntity();

	Config* config = Config::GetInstance();

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_LANGUAGE_BACK_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		OptionsCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_FLAG_EN_BUTTON )
	{
		GetApp()->buttonClickSound();
		config->setLang( convertCodeToId( LANG_NAMES[ LANG_EN ] ) );
		config->Save();
		config->ReloadLang( LANG_EN );
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		OptionsCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_FLAG_RU_BUTTON )
	{
		GetApp()->buttonClickSound();
		config->setLang( convertCodeToId( LANG_NAMES[ LANG_RU ] ) );
		config->Save();
		config->ReloadLang( LANG_RU );
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		OptionsCreate( pEntClicked->GetParent()->GetParent() );
	}

	config->FreeInstance();
}
开发者ID:maximbilan,项目名称:tblock,代码行数:38,代码来源:GUI_Language.cpp

示例8: RemoveAllEntities

		//-------------------------------------------------------
		//-------------------------------------------------------
		void Scene::RemoveAllEntities()
		{
			for(u32 i=0; i<m_entities.size(); ++i)
			{
                Entity* ent = m_entities[i].get();
                
                if (ent->GetParent() == nullptr)
                {
                    if (m_entitiesActive == true)
                    {
                        if (m_entitiesForegrounded == true)
                        {
                            ent->OnBackground();
                        }
                        ent->OnSuspend();
                    }
                    
                    ent->OnRemovedFromScene();
                    ent->SetScene(nullptr);
                }
			}
            
            m_entities.clear();
		}
开发者ID:mclaughlinhugh4,项目名称:ChilliSource,代码行数:26,代码来源:Scene.cpp

示例9: GameOnSelect

void GameOnSelect( VariantList* pVList )
{
	Entity *pEntClicked = pVList->m_variant[1].GetEntity();

	Tetris* tetris = Tetris::GetInstance();
	Config* config = Config::GetInstance();

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_MENU_BUTTON )
	{
		GetApp()->buttonClickSound();

		if( tetris->isEndGame() )
		{
			SlideScreen( pEntClicked->GetParent(), false );
			GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		
			GetApp()->setGame( false );
			GetApp()->setContinueBtn( false );

			if( tetris->getScoreInt() > config->getMinScore() )
			{
				GameState::SetState( new GS_Menu() );
				InputBestScoreCreate( pEntClicked->GetParent()->GetParent() );
			}
			else
			{
				tetris->ResetEndGame();

				GameState::SetState( new GS_Menu() );
				MainMenuCreate( pEntClicked->GetParent()->GetParent() );
			}
		
			tetris->FreeInstance();
			config->FreeInstance();

			return;
		}

		GameState::SetState( new GS_Menu() );

		if( config->getMusic() )
		{
			GetAudioManager()->StopMusic();
		}
		
		GetApp()->setGame( false );
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		MainMenuCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_DOWN && !tetris->isEndGame() )
	{
		if( config->getSoundEffects() )
		{
			GetAudioManager()->Play( GetApp()->getResourceInstance()->getItem(GetApp()->getResolutionType(), RES_TYPE_AUDIO, RES_ID_AUDIO_FIGURE_DOWN ) );
		}
		tetris->ClickForceDown();
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_LEFT && !tetris->isEndGame() )
	{
		buttonMoveSound();
		tetris->ClickLeft();
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_RIGHT && !tetris->isEndGame() )
	{
		buttonMoveSound();
		tetris->ClickRight();
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_GAMEPLAY_ROTATE && !tetris->isEndGame() )
	{
		buttonMoveSound();
		tetris->ClickRotate();
	}

	tetris->FreeInstance();
	config->FreeInstance();
}
开发者ID:maximbilan,项目名称:tblock,代码行数:81,代码来源:GUI_Game.cpp

示例10: PhysicalObject

SceneEntity::SceneEntity(const Entity& obj) : PhysicalObject(obj)
{
    name = obj.GetParent();
}
开发者ID:metatomato,项目名称:SceneGraph,代码行数:4,代码来源:SceneObject.cpp

示例11: OptionsOnSelect

void OptionsOnSelect( VariantList* pVList )
{
	Entity* pEntClicked = pVList->m_variant[1].GetEntity();

	Config* config = Config::GetInstance();

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_OPTIONS_BACK_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		MainMenuCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_OPTIONS_LANGUAGE_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		LanguageCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_OPTIONS_SOUND_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		SoundCreate( pEntClicked->GetParent()->GetParent() );
	}

	if( pEntClicked->GetName() == GUI_IMAGEBUTTON_OPTIONS_LEVEL_BUTTON )
	{
		GetApp()->buttonClickSound();
		SlideScreen( pEntClicked->GetParent(), false );
		GetMessageManager()->CallEntityFunction( pEntClicked->GetParent(), 500, "OnDelete", NULL );
		LevelMenuCreate( pEntClicked->GetParent()->GetParent() );
	}

	config->FreeInstance();
}
开发者ID:maximbilan,项目名称:tblock,代码行数:40,代码来源:GUI_Options.cpp


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