making a stab at updating Shapes

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-03-13 09:33:32 -04:00
parent e32a373dc9
commit c3d69746c1
16 changed files with 300 additions and 746 deletions
+3 -9
View File
@@ -30,14 +30,9 @@ namespace physics
{
namespace box2d
{
PolygonShape::PolygonShape(Body * body, b2PolygonDef * def)
: Shape(body)
PolygonShape::PolygonShape(b2PolygonShape * p)
{
for(int i = 0; i<def->vertexCount; i++)
def->vertices[i] = body->world->scaleDown(def->vertices[i]);
def->userData = (void*)data;
shape = body->body->CreateShape(def);
shape = p;
}
PolygonShape::~PolygonShape()
@@ -48,11 +43,10 @@ namespace box2d
{
love::luax_assert_argc(L, 0);
b2PolygonShape * p = (b2PolygonShape *)shape;
const b2Vec2 * vertices = p->GetVertices();
int count = p->GetVertexCount();
for(int i = 0;i<count; i++)
{
b2Vec2 v = body->world->scaleUp(body->body->GetWorldPoint(vertices[i]));
b2Vec2 v = p->GetVertex(i);
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
}