cpSpaceBBQuery

Official forum for the Chipmunk2D Physics Library.
Post Reply
Fanda
Posts: 1
Joined: Sat May 16, 2015 3:00 am
Contact:

cpSpaceBBQuery

Post by Fanda »

I am trying to use cpSpaceBBQuery function for drawing selected objects. Draw function is not called in my code. Objects shapes coordinates are inside the ScreenBox.
I can't find any example for using function cpSpaceBBQuery.

Thanks a lot for advices

Code: Select all


/*
ScreenBox.l = 0;
ScreenBox.t = 0;
ScreenBox.r = 1280;
ScreenBox.b = 760;

static_objects_filter.categories = 1;
static_objects_filter.group = 0;
static_objects_filter.mask = 1 | 2 | 3;
...
cpShapeSetFilter(static_objects[i][ii].shape, static_objects_filter);
...
*/

void draw(cpShape *shape, void *data)
{
	draw_bitmap(bitmap_static_objects[0],
		STATIC_OBJECT_W / 2, STATIC_OBJECT_H / 2,
		cpBodyGetPosition(cpShapeGetBody(shape)).x - ScreenBox.l,
		cpBodyGetPosition(cpShapeGetBody(shape)).y - ScreenBox.t,
		0, 0);

printf("Called?");     /*no printf*/
}

void to_display()
{
	cpSpaceBBQuery(space, ScreenBox, static_objects_filter, (cpSpaceBBQueryFunc)draw, 0);
}
Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests