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


C++ Rectangle::Contains方法代码示例

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


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

示例1: GetImageIndexByPoint

long JMChattControl::GetImageIndexByPoint(Point point)
{
	long i=0;
	stCHATT_DATA* pChattData = null;
	Rectangle rtElementBox;


	for(i=__stScreenInfo.nViewAreaStartIndex ; i <= __stScreenInfo.nViewAreaEndIndex ; i++) {
		pChattData = (stCHATT_DATA*)(__pArrayChattData->GetAt(i));


		rtElementBox = ChangeRightRectangleToNormal(pChattData->rtElementBox);


		if( rtElementBox.Contains(point) ) {
			return i;
		}
	}
	return -1;
}
开发者ID:JunminLee,项目名称:Winwin,代码行数:20,代码来源:JMChattControl.cpp

示例2: SyncRegions

void WorldEntityManager::SyncRegions(Vector3 center, float range)
{
	Rectangle selectionRect = Rectangle(center.x - range, center.z - range, range * 2, range * 2);
	
	set<EntityPtr> newRegions;
	for (const EntityPtr & region : m_entityRegions) {
		Vector3 regionPosition = region->GetComponent<Components::Position>("Position")->Pos;
		if (selectionRect.Contains(regionPosition.x, regionPosition.z)) {
			newRegions.insert(region);
		}
	}
	// Only sync if the two sets are not equal
	if (newRegions != m_loadedEntityRegions) {
		// uncache entities that fall outside of the new region set
		for (auto & region : m_loadedEntityRegions) {
			if (newRegions.count(region) == 0) {
				m_quadTree.Remove(RegionArea(region));
			}
		}
		// cache entities in regions that haven't been loaded yet
		for (auto & region : newRegions) {
			if (m_loadedEntityRegions.count(region) == 0) {
				// Add the entities to the quadTree
				for (auto & entityID : region->GetComponent<Components::EntityRegion>("EntityRegion")->Entities) {
					EntityPtr entity;
					if (Find(entityID, entity)) {
						Vector3 pos3D = entity->GetComponent<Components::Position>("Position")->Pos;
						Vector2 pos2D = Vector2(pos3D.x, pos3D.z);
						m_quadTree.Insert(pos2D, entityID);
					}
				}
				m_loadedEntityRegions.insert(region);
			}
		}
		// load the new regions
		m_loadedEntityRegions = newRegions;
	}
}
开发者ID:sg-p4x347,项目名称:Procedural-RPG,代码行数:38,代码来源:WorldEntityManager.cpp


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