• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ removeEntity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中removeEntity函数的典型用法代码示例。如果您正苦于以下问题:C++ removeEntity函数的具体用法?C++ removeEntity怎么用?C++ removeEntity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: switch

void Scene::unlink( Object* child )
{
	switch( child->m_feature )
	{
	case Object::Feature:
		break;
	case Entity::Feature:
		removeEntity( (Entity*)child );
		break;
	case Camera::Feature:
		removeEntity( (Entity*)child );
		removeCamera( (Camera*)child );
		break;
	/*case Element::Light:
		break;*/
	default:
		MAGICAL_ASSERT( false, "Invalid!" );
		break;
	}

	for( auto itr : child->m_children )
	{
		unlink( itr );
	}
}
开发者ID:parton,项目名称:magical-engine,代码行数:25,代码来源:Scene.cpp


示例2: removeEntity

void Mainscene::reset(){
    for(unsigned int i = 0; i < towers.size(); i++){
        removeEntity(towers[i]);
        delete towers[i];
        towers[i] = NULL;
    }
    towers.clear();
    for(unsigned int i = 0; i < enemies.size(); i ++){
        removeEntity(enemies[i]);
        delete enemies[i];
        enemies[i] = NULL;
    }
    enemies.clear();

    for(unsigned int i = 0; i < bullets.size(); i ++){
        removeEntity(bullets[i]);
        delete bullets[i];
        bullets[i] = NULL;
    }
    bullets.clear();

    lockedItem = NULL;
    dreamHealth = 100;
    coins = 100;

    wave = 0;
    enemiesToSpawn = 10;
    waveEnd = true;

}
开发者ID:meruiden,项目名称:SDL2-Opengl_Engine,代码行数:30,代码来源:mainscene.cpp


示例3: removeEntity

/**
 * Implementation of update. Updates the arrow.
 */
void RS_Leader::update() {

    // find and delete arrow:
	for(auto e: entities){
        if (e->rtti()==RS2::EntitySolid) {
            removeEntity(e);
            break;
        }
    }

        if (isUndone()) {
                return;
        }

    RS_Entity* fe = firstEntity();
    if (fe && fe->isAtomic()) {
        RS_Vector p1 = ((RS_AtomicEntity*)fe)->getStartpoint();
        RS_Vector p2 = ((RS_AtomicEntity*)fe)->getEndpoint();

        // first entity must be the line which gets the arrow:
        if (hasArrowHead()) {
            RS_Solid* s = new RS_Solid(this, RS_SolidData());
            s->shapeArrow(p1,
                          p2.angleTo(p1),
                          getGraphicVariableDouble("$DIMASZ", 2.5)* getGraphicVariableDouble("$DIMSCALE", 1.0));
            s->setPen(RS_Pen(RS2::FlagInvalid));
			s->setLayer(nullptr);
            RS_EntityContainer::addEntity(s);
        }
    }
    calculateBorders();
}
开发者ID:Azen2011,项目名称:LibreCAD,代码行数:35,代码来源:rs_leader.cpp


示例4: assert

bool Map::removePlayer (ClientId clientId)
{
	assert(_entityRemovalAllowed);

	for (PlayerListIter i = _playersWaitingForSpawn.begin(); i != _playersWaitingForSpawn.end(); ++i) {
		if ((*i)->getClientId() != clientId)
			continue;
		(*i)->remove();
		delete *i;
		_playersWaitingForSpawn.erase(i);
		sendPlayersList();
		return true;
	}

	for (PlayerListIter i = _players.begin(); i != _players.end(); ++i) {
		if ((*i)->getClientId() != clientId)
			continue;

		removeEntity(0, **i);
		(*i)->remove();
		delete *i;
		_players.erase(i);
		return true;
	}
	error(LOG_MAP, String::format("could not find the player with the clientId %i", clientId));
	return false;
}
开发者ID:ptitSeb,项目名称:caveexpress,代码行数:27,代码来源:Map.cpp


示例5: removeCollisionSprite

void Scene::deleteSprite(Sprite **sprite) {
    removeCollisionSprite(*sprite);
    removeSurface((*sprite)->getSurface());
    removeEntity(*sprite);
    delete *sprite;
    *sprite = NULL;
}
开发者ID:vincenthamm,项目名称:scummvm,代码行数:7,代码来源:scene.cpp


示例6: foreach

/**
 * Removes invalid objects.
 * @return how many objects were removed
 */
int RS_Graphic::clean()
{
    // author: ravas

    int how_many = 0;

    foreach (RS_Entity* e, entities)
    {
        if    (e->getMin().x > e->getMax().x
            || e->getMin().y > e->getMax().y
            || e->getMin().x > RS_MAXDOUBLE
            || e->getMax().x > RS_MAXDOUBLE
            || e->getMin().x < RS_MINDOUBLE
            || e->getMax().x < RS_MINDOUBLE
            || e->getMin().y > RS_MAXDOUBLE
            || e->getMax().y > RS_MAXDOUBLE
            || e->getMin().y < RS_MINDOUBLE
            || e->getMax().y < RS_MINDOUBLE)
        {
            removeEntity(e);
            how_many += 1;
        }
    }
    return how_many;
}
开发者ID:janelia-idf,项目名称:LibreCAD,代码行数:29,代码来源:rs_graphic.cpp


示例7: removeEntity

/**
 * Implementation of update. Updates the arrow.
 */
void RS_Leader::update() {

    // find and delete arrow:
    for (RS_Entity* e=firstEntity(); e!=NULL; e=nextEntity()) {
        if (e->rtti()==RS2::EntitySolid) {
            removeEntity(e);
            break;
        }
    }

    if (isUndone()) {
        setVisible(false);
        return;
    }

    RS_Entity* fe = firstEntity();
    if (fe!=NULL && fe->isAtomic()) {
        RS_Vector p1 = ((RS_AtomicEntity*)fe)->getStartpoint();
        RS_Vector p2 = ((RS_AtomicEntity*)fe)->getEndpoint();

        // first entity must be the line which gets the arrow:
        if (hasArrowHead()) {
            RS_Solid* s = new RS_Solid(this, RS_SolidData());
            s->shapeArrow(p1,
                          p2.angleTo(p1),
                          getGraphicVariableDouble("$DIMASZ", 2.5));
            s->setPen(RS_Pen(RS2::FlagInvalid));
            s->setLayer(NULL);
            RS_EntityContainer::addEntity(s);
        }
    }
}
开发者ID:jacklibj,项目名称:2.0.5.0-1-community.src,代码行数:35,代码来源:rs_leader.cpp


示例8: TEST

TEST(LuaUIOperationsTest, Rotate) {
	QApplication app(argc, argv);
	LuaInterface luaInterface;
	auto L = luaInterface.luaState();

	luaInterface.hideUI(true);
	luaInterface.initLua();

	auto mdiArea = LuaIntf::Lua::getGlobal<QMdiArea*>(L, "mdiArea");

	if(mdiArea->subWindowList().count() == 0) {
		LuaIntf::LuaRef(L, "new_file")();
	}

	mdiArea->setActiveSubWindow(mdiArea->subWindowList().at(0));

	auto mdiChild = dynamic_cast<CadMdiChild*>(mdiArea->activeSubWindow()->widget());
	auto storageManager = mdiChild->storageManager();
	auto documentCanvas = mdiChild->viewer()->documentCanvas();

	lc::entity::Line_CSPtr createdEntity;
	std::vector<lc::entity::CADEntity_CSPtr> entities;

	entities = storageManager->entityContainer().asVector();

	for(auto entity : entities) {
		storageManager->removeEntity(entity);
	}

	EXPECT_EQ(0, storageManager->entityContainer().asVector().size());



	LuaIntf::LuaRef(L, "create_line")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 100));

	EXPECT_EQ(1, storageManager->entityContainer().asVector().size()) << "Line was not created";



	documentCanvas->makeSelection(0, 0, 100, 100, false, false);
	documentCanvas->closeSelection();

	EXPECT_EQ(1, mdiChild->selection().size()) << "Entity not selected";



	LuaIntf::LuaRef(L, "rotate_selected_entities")();
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 0));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(0, 100));
	LuaIntf::LuaRef(L, "event.trigger")("point", lc::geo::Coordinate(100, 0));

	entities = storageManager->entityContainer().asVector();
	createdEntity = std::dynamic_pointer_cast<const lc::entity::Line>(entities.at(0));

	EXPECT_EQ(lc::geo::Coordinate(0, 0), createdEntity->start());
	EXPECT_EQ(lc::geo::Coordinate(100, -100), createdEntity->end());
}
开发者ID:LibreCAD,项目名称:LibreCAD_3,代码行数:59,代码来源:testluaoperations.cpp


示例9: tmp

void EntityManager::removeAllEntities()
{
  EntityArray tmp(entities_);
  EntityArray::iterator it = tmp.begin();
  for (; it != tmp.end(); ++it) {
    removeEntity(*it);
  }
}
开发者ID:Th30n,项目名称:into-the-dungeon,代码行数:8,代码来源:EntityManager.cpp


示例10: Entity

//////////////////////////////////////////////////////////////////////////
// removeAllEntities
void ScnCore::removeAllEntities()
{
	for( ScnEntityListIterator It( EntityList_.begin() ); It != EntityList_.end(); ++It )
	{
		ScnEntityRef Entity( *It );
		removeEntity( Entity );
	}
}
开发者ID:wdmchaft,项目名称:Psybrus,代码行数:10,代码来源:ScnCore.cpp


示例11: removeEntity

void IfcPPModel::removeEntity( int entity_id )
{
	auto it_find = m_map_entities.find(entity_id);
	if( it_find != m_map_entities.end() )
	{
		shared_ptr<IfcPPEntity> entity_found = it_find->second;
		removeEntity( entity_found );
	}
}
开发者ID:PanicSheep,项目名称:ifcplusplus,代码行数:9,代码来源:IfcPPModel.cpp


示例12: getEntityByAvatarID

bool Scene::removePlayer(AvatarID avatarID)
{
    auto entity = getEntityByAvatarID(avatarID);
    if (entity)
    {
        return removeEntity(entity->_state.eid);
    }
    return false;
}
开发者ID:zsummer,项目名称:breeze,代码行数:9,代码来源:scene.cpp


示例13: removeEntity

void CHUD_Radar::setSubject(ILocalEntity * entity)
{
    m_subject = entity;

    // L'entité ne peut pas être dans la liste des entités suivies
    if (isEntity(m_subject))
    {
        removeEntity(m_subject);
    }
}
开发者ID:teddy-michel,项目名称:TEngine,代码行数:10,代码来源:CHUD_Radar.cpp


示例14: debug

void Map::visitEntities (IEntityVisitor *visitor, const EntityType& type)
{
	if (type == EntityType::NONE || type == EntityTypes::PLAYER) {
		bool needUpdate = false;
		for (PlayerListIter i = _players.begin(); i != _players.end();) {
			Player* e = *i;
			if (visitor->visitEntity(e)) {
				debug(LOG_SERVER, String::format("remove player by visit %i: %s", e->getID(), e->getType().name.c_str()));
				removeEntity(ClientIdToClientMask(e->getClientId()), *e);
				delete *i;
				i = _players.erase(i);
				needUpdate = true;
			} else {
				++i;
			}
		}
		if (needUpdate) {
			if (_players.empty()) {
				resetCurrentMap();
				return;
			}
		}
	}

	// changing the entities list is not allowed here. Adding or removing
	// would invalidate the iterators
	for (Map::EntityListIter i = _entities.begin(); i != _entities.end();) {
		IEntity* e = *i;
		if (type.isNone() || e->getType() == type) {
			if (visitor->visitEntity(e)) {
				debug(LOG_SERVER, String::format("remove entity by visit %i: %s", e->getID(), e->getType().name.c_str()));
				removeEntity(0, *e);
				(*i)->remove();
				delete *i;
				i = _entities.erase(i);
			} else {
				++i;
			}
		} else {
			++i;
		}
	}
}
开发者ID:ptitSeb,项目名称:caveexpress,代码行数:43,代码来源:Map.cpp


示例15: removeEntity

	void GameEntitySystem::removeDeadEntities()
	{
		std::list<int>::iterator listIterator;
		for(listIterator = deadList->begin(); listIterator != deadList->end(); ++listIterator)
		{
			removeEntity((*listIterator));
		}

		deadList->clear();
	}
开发者ID:SahandMalaei,项目名称:EagleEngine,代码行数:10,代码来源:EntitySystem.cpp


示例16: getEntities

void EntityEngine::removeEntity(Entity * ent, Engines & e) {
// find the pointer
	auto it = std::find(getEntities().begin(), getEntities().end(), ent);

	if (it == getEntities().end()) {
		logging::Fatal() << "Could not find entity to remove in entity list";
	} else {
		removeEntity(it, e);
	}
}
开发者ID:poseidn,项目名称:KungFoo-legacy,代码行数:10,代码来源:EntityEngine.cpp


示例17: trySpawn

void Level::tick()
{
	trySpawn(1);

	int tilesTickAttempts = w * h / 50;
	for (int i = 0; i < tilesTickAttempts; ++i)
	{
		int xt = random->nextInt(w);
		int yt = random->nextInt(h);
		getTile(xt, yt)->tick(this, xt, yt);
	}
	for (list<Entity*>::iterator it = entities.begin(); it != entities.end(); it++ )
	{
		Entity * e = *it;
		int xto = e->x >> 4;
		int yto = e->y >> 4;

		e->tick();

		if (e->removed)
		{
			removeEntity(xto, yto, e);
			//we should not delete player, because it will freeze on death
			//we should not delete furniture, because it is used in FurnitureItem, when taken
			if (!e->instanceOf(PLAYER) && !e->instanceOf(FURNITURE))
				delete e;
			it = entities.erase(it);
		}
		else
		{
			int xt = e->x >> 4;
			int yt = e->y >> 4;

			if (xto != xt || yto != yt)
			{
				removeEntity(xto, yto, e);
				insertEntity(xt, yt, e);
			}
		}
	}
}
开发者ID:konchunas,项目名称:minicraft-psp,代码行数:41,代码来源:Level.cpp


示例18: while

void Mainscene::removeBullet(Bullet* b){
    std::vector< Bullet* >::iterator it = bullets.begin();
    while (it != bullets.end()) {
        if ((*it)->getEntityId() == b->getEntityId()) {
            removeEntity((*it));
            delete (*it);
            (*it) = NULL;
            it = bullets.erase(it);
        } else {
            ++it;
        }
    }
}
开发者ID:meruiden,项目名称:SDL2-Opengl_Engine,代码行数:13,代码来源:mainscene.cpp


示例19: removeEntity

void Level::remove(Entity * e)
{
	entities.remove(e);
//	for (list<Entity*>::iterator it = entities.begin(); it != entities.end(); it++ )
//	{
//		if (*it == e)
//		{
//			entities.erase(it);
//			break;
//		}
//	}
	int xto = e->x >> 4;
	int yto = e->y >> 4;
	removeEntity(xto, yto, e);
}
开发者ID:konchunas,项目名称:minicraft-psp,代码行数:15,代码来源:Level.cpp


示例20: removeEntity

void Scene::update()
{
	for ( std::list<Entity*>::iterator it = _entities.begin(); it != _entities.end(); it++ )
	{
		(*it)->update();
	}

	// Deletes entities pushed into _deleteEntities list
	for ( std::list<Entity*>::iterator it = _deleteEntities.begin(); it!= _deleteEntities.end(); it++)
	{
		removeEntity( (*it) );
	}

	_deleteEntities.clear();
}
开发者ID:killerasus,项目名称:adaptive_shooter,代码行数:15,代码来源:Scene.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ removeEntry函数代码示例发布时间:2022-05-30
下一篇:
C++ removeEffect函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap