本文整理汇总了C++中MapEntity::overlaps方法的典型用法代码示例。如果您正苦于以下问题:C++ MapEntity::overlaps方法的具体用法?C++ MapEntity::overlaps怎么用?C++ MapEntity::overlaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapEntity
的用法示例。
在下文中一共展示了MapEntity::overlaps方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_collision_with_entities
bool Map::test_collision_with_entities(const Rectangle& collision_box, MapEntity& check_entity) {
std::list<MapEntity*>& obstacle_entities = entities->get_obstacle_entities();
bool collision = false;
std::list<MapEntity*>::iterator it;
for(it = obstacle_entities.begin(); it != obstacle_entities.end() && !collision; it++) {
MapEntity* entity = *it;
collision = entity != &check_entity
&& entity->overlaps(collision_box)
&& entity->is_obstacle_for(check_entity);
}
return collision;
}
示例2: test_collision_with_entities
/**
* \brief Tests whether a rectangle overlaps an obstacle dynamic entity.
* \param layer The layer.
* \param collision_box The rectangle to check.
* \param entity_to_check The entity to check (used to decide what is
* considered as obstacle).
* \return \c true if there is an obstacle entity at this point.
*/
bool Map::test_collision_with_entities(
Layer layer,
const Rectangle& collision_box,
const MapEntity& entity_to_check) const {
const std::list<MapEntity*>& obstacle_entities =
entities->get_obstacle_entities(layer);
const std::list<MapEntity*>::const_iterator end =
obstacle_entities.end();
std::list<MapEntity*>::const_iterator it;
for (it = obstacle_entities.begin(); it != end; ++it) {
MapEntity* entity = *it;
if (entity->overlaps(collision_box)
&& entity->is_obstacle_for(entity_to_check)
&& entity->is_enabled()
&& entity != &entity_to_check)
return true;
}
return false;
}
示例3: test_collision_rectangle
bool Detector::test_collision_rectangle(MapEntity& entity) {
return entity.overlaps(*this);
}