mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
making a stab at updating Shapes
--HG-- branch : box2d-update
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user