Ejemplo n.º 1
0
Vector<PhysicsShape*> PhysicsWorld::getShapes(const Point& point) const
{
    Vector<PhysicsShape*> arr;
    cpSpaceNearestPointQuery(this->_info->getSpace(),
                             PhysicsHelper::point2cpv(point),
                             0,
                             CP_ALL_LAYERS,
                             CP_NO_GROUP,
                             (cpSpaceNearestPointQueryFunc)PhysicsWorldCallback::getShapesAtPointFunc,
                             &arr);
    
    return arr;
}
Array* PhysicsWorld::getShapes(const Point& point) const
{
    Array* arr = Array::create();
    cpSpaceNearestPointQuery(this->_info->getSpace(),
                             PhysicsHelper::point2cpv(point),
                             0,
                             CP_ALL_LAYERS,
                             CP_NO_GROUP,
                             (cpSpaceNearestPointQueryFunc)PhysicsWorldCallback::getShapesAtPointFunc,
                             arr);
    
    return arr;
}
Ejemplo n.º 3
0
void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Point& point, void* data)
{
    CCASSERT(func != nullptr, "func shouldn't be nullptr");
    
    if (func != nullptr)
    {
        PointQueryCallbackInfo info = {this, func, data};
        
        PhysicsWorldCallback::continues = true;
        cpSpaceNearestPointQuery(this->_info->getSpace(),
                                 PhysicsHelper::point2cpv(point),
                                 0,
                                 CP_ALL_LAYERS,
                                 CP_NO_GROUP,
                                 (cpSpaceNearestPointQueryFunc)PhysicsWorldCallback::queryPointFunc,
                                 &info);
    }
}
Ejemplo n.º 4
0
void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& point, void* data)
{
    CCASSERT(func != nullptr, "func shouldn't be nullptr");
    
    if (func != nullptr)
    {
        if (!_delayAddBodies.empty() || !_delayRemoveBodies.empty())
        {
            updateBodies();
        }
        PointQueryCallbackInfo info = {this, func, data};
        
        PhysicsWorldCallback::continues = true;
        cpSpaceNearestPointQuery(_cpSpace,
                                 PhysicsHelper::point2cpv(point),
                                 0,
                                 CP_ALL_LAYERS,
                                 CP_NO_GROUP,
                                 (cpSpaceNearestPointQueryFunc)PhysicsWorldCallback::queryPointFunc,
                                 &info);
    }
}
Ejemplo n.º 5
0
inline void space_nearest_point_query(cpSpace *space, cpVect point, cpFloat maxDistance,
                                      cpLayers layers, cpGroup group, void *f) {
  cpSpaceNearestPointQuery(space, point, maxDistance, layers, group, nearestPointQuery, f);
}
Ejemplo n.º 6
0
void Space::nearestPointQuery(cpVect point,cpFloat maxDistance,cpLayers layers,cpGroup group,SpaceNearestPointQueryFunc func)
{
		cpSpaceNearestPointQuery(space,point,maxDistance,layers,group,*SpaceNearestPointQuery,&func);
}
Ejemplo n.º 7
0
void Space::nearestPointQuery(const cp::Vect& point,cpFloat maxDistance,cpLayers layers,cpGroup group,cpSpaceNearestPointQueryFunc func,void *data)
{
		cpSpaceNearestPointQuery(space,point,maxDistance,layers,group,func,data);
}