本文整理汇总了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;
}
示例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;
}
}