Exemple #1
0
static void set_polygon_shape(	const World& trans,
								const float l, const float t, const float r, const float b,
								b2PolygonShape& out) {
	const b2Vec2	lt = trans.Ci2BoxTranslation(ci::Vec3f(l, t, 0.0f), nullptr); // using nullptr for the sprite will make the polygon be in world space
	const b2Vec2	rb = trans.Ci2BoxTranslation(ci::Vec3f(r, b, 0.0f), nullptr);
	b2Vec2			vtx[4];
	vtx[0].Set(lt.x, lt.y);
	vtx[1].Set(rb.x, lt.y);
	vtx[2].Set(rb.x, rb.y);
	vtx[3].Set(lt.x, rb.y);
	out.Set(vtx, 4);
}