Beispiel #1
0
cpShape *
cpSpacePointQueryFirst(cpSpace *space, cpVect point, cpLayers layers, cpGroup group)
{
	cpShape *shape = NULL;
	cpSpacePointQuery(space, point, layers, group, (cpSpacePointQueryFunc)rememberLastPointQuery, &shape);
	
	return shape;
}
Vector<PhysicsShape*> PhysicsWorld::getShapes(const Vec2& point) const
{
    Vector<PhysicsShape*> arr;
    cpSpacePointQuery(_cpSpace,
                             PhysicsHelper::point2cpv(point),
                             0,
                             CP_SHAPE_FILTER_ALL,
                             (cpSpacePointQueryFunc)PhysicsWorldCallback::getShapesAtPointFunc,
                             &arr);
    
    return arr;
}
Beispiel #3
0
void *world_pointQuery(World_t *aWorld, vec2_t aPoint, bool aQueryForShape)
{
    cpShape *cpShape = NULL;
    cpSpacePointQuery(aWorld->cpSpace, VEC2_TO_CPV(aPoint), CP_ALL_LAYERS, CP_NO_GROUP, (cpSpacePointQueryFunc)_pointQueryCallback, &cpShape);

    if(!cpShape)
        return NULL;
    if(aQueryForShape)
        return cpShape->data;
    else
        return cpShape->body->data;
}
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;
        cpSpacePointQuery(_cpSpace,
                                 PhysicsHelper::point2cpv(point),
                                 0,
                                 CP_SHAPE_FILTER_ALL,
                                 (cpSpacePointQueryFunc)PhysicsWorldCallback::queryPointFunc,
                                 &info);
    }
}
Beispiel #5
0
inline void space_point_query(cpSpace *s, cpVect point, cpLayers layers, cpGroup group, void *p) {
  cpSpacePointQuery(s, point, layers, group, pointQuery, p);
}
Beispiel #6
0
void Space::pointQuery(cpVect point,cpLayers layers,cpGroup group,SpacePointQueryFunc func)
{
		cpSpacePointQuery(space,point,layers,group,*SpacePointQuery,&func);
}
Beispiel #7
0
void Space::pointQuery(const cp::Vect& point,cpLayers layers,cpGroup group,cpSpacePointQueryFunc func,void *data)
{
		cpSpacePointQuery(space,point,layers,group,func,data);
}
Beispiel #8
0
// From cpSpace.h
void wrSpacePointQuery(cpSpace *space, cpVect *point, cpLayers layers,
                       cpGroup group, cpSpacePointQueryFunc func) {
    cpSpacePointQuery(space, *point, layers, group, func, NULL);
}