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
+16 -29
View File
@@ -30,41 +30,28 @@ namespace physics
{
namespace box2d
{
CircleShape::CircleShape(Body * body, b2CircleDef * def)
: Shape(body)
CircleShape::CircleShape(b2CircleShape * c)
{
def->localPosition = body->world->scaleDown(def->localPosition);
def->radius = body->world->scaleDown(def->radius);
radius = def->radius;
this->localPosition = def->localPosition;
def->userData = (void*)data;
shape = body->body->CreateShape(def);
shape = c;
}
CircleShape::~CircleShape()
{
shape = NULL;
}
float CircleShape::getRadius() const
{
return body->world->scaleUp(radius);
}
void CircleShape::getLocalCenter(float & x, float & y) const
{
x = localPosition.x;
y = localPosition.y;
body->world->scaleUp(x, y);
}
void CircleShape::getWorldCenter(float & x, float & y) const
{
b2Vec2 worldCenter = body->body->GetWorldPoint(localPosition);
worldCenter = body->world->scaleUp(worldCenter);
x = worldCenter.x;
y = worldCenter.y;
}
float CircleShape::getRadius() const
{
return shape->m_radius;
}
/**
* Gets the radius for the circle.
**/
void CircleShape::setRadius(float r)
{
shape->m_radius = r;
}
} // box2d
} // physics