Add Fixture:getNext()

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-09-24 12:32:28 -04:00
parent c705063597
commit e962891ba2
4 changed files with 26 additions and 0 deletions
+9
View File
@@ -133,6 +133,15 @@ namespace box2d
{
return shape;
}
Fixture * Fixture::getNext() const
{
b2Fixture * f = fixture->GetNext();
if (!f) return NULL;
Fixture * fix = (Fixture *)Memoizer::find(f);
if (!fix) fix = new Fixture(f);
return fix;
}
void Fixture::setFilterData(int * v)
{
+5
View File
@@ -106,6 +106,11 @@ namespace box2d
**/
Body * getBody() const;
/**
* Gets the next Fixture attached to the parent Body.
**/
Fixture * getNext() const;
/**
* Sets the filter data. An integer array is used even though the
* first two elements are unsigned shorts. The elements are:
@@ -122,6 +122,16 @@ namespace box2d
luax_newtype(L, "Shape", PHYSICS_SHAPE_T, (void*)shape);
return 1;
}
int w_Fixture_getNext(lua_State * L)
{
Fixture * t = luax_checkfixture(L, 1);
Fixture * f = t->getNext();
if (f == 0) return 0;
f->retain();
luax_newtype(L, "Fixture", PHYSICS_FIXTURE_T, (void*)f);
return 1;
}
int w_Fixture_testPoint(lua_State * L)
{
@@ -254,6 +264,7 @@ namespace box2d
{ "getDensity", w_Fixture_getDensity },
{ "getBody", w_Fixture_getBody },
{ "getShape", w_Fixture_getShape },
{ "getNext", w_Fixture_getNext },
{ "isSensor", w_Fixture_isSensor },
{ "testPoint", w_Fixture_testPoint },
{ "rayCast", w_Fixture_rayCast },
+1
View File
@@ -43,6 +43,7 @@ namespace box2d
int w_Fixture_isSensor(lua_State * L);
int w_Fixture_getBody(lua_State * L);
int w_Fixture_getShape(lua_State * L);
int w_Fixture_getNext(lua_State * L);
int w_Fixture_testPoint(lua_State * L);
int w_Fixture_rayCast(lua_State * L);
int w_Fixture_setFilterData(lua_State * L);