mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Add mandatory density argument to Body:createFixture
--HG-- branch : box2d-update
This commit is contained in:
@@ -365,9 +365,9 @@ namespace box2d
|
||||
return world;
|
||||
}
|
||||
|
||||
Fixture * Body::createFixture(Shape * shape)
|
||||
Fixture * Body::createFixture(Shape * shape, float density)
|
||||
{
|
||||
return new Fixture(this, shape);
|
||||
return new Fixture(this, shape, density);
|
||||
}
|
||||
|
||||
void Body::destroyFixture(Fixture * fixture)
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace box2d
|
||||
*/
|
||||
World * getWorld() const;
|
||||
|
||||
Fixture * createFixture(Shape * shape);
|
||||
Fixture * createFixture(Shape * shape, float density);
|
||||
|
||||
void destroyFixture(Fixture * fixture);
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace physics
|
||||
{
|
||||
namespace box2d
|
||||
{
|
||||
Fixture::Fixture(Body * body, Shape * shape)
|
||||
Fixture::Fixture(Body * body, Shape * shape, float density)
|
||||
: body(body), shape(shape), fixture(NULL)
|
||||
{
|
||||
body->retain();
|
||||
@@ -44,6 +44,7 @@ namespace box2d
|
||||
b2FixtureDef def;
|
||||
def.shape = shape->shape;
|
||||
def.userData = (void *)data;
|
||||
def.density = density;
|
||||
fixture = body->body->CreateFixture(&def);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace box2d
|
||||
/**
|
||||
* Creates a Fixture.
|
||||
**/
|
||||
Fixture(Body * body, Shape * shape);
|
||||
Fixture(Body * body, Shape * shape, float density);
|
||||
|
||||
virtual ~Fixture();
|
||||
|
||||
|
||||
@@ -497,7 +497,8 @@ namespace box2d
|
||||
{
|
||||
Body * t = luax_checkbody(L, 1);
|
||||
Shape * s = luax_checktype<Shape>(L, 2, "Shape", PHYSICS_SHAPE_T);
|
||||
Fixture * f = t->createFixture(s);
|
||||
float d = (float)luaL_checknumber(L, 3);
|
||||
Fixture * f = t->createFixture(s, d);
|
||||
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user