mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
Rename love.physics getObjectList functions to getObjects (resolves #1305)
World:getBodyList -> World:getBodies World:getContactList -> World:getContacts World:getJointList -> World:getJoints Body:getFixtureList -> Body:getFixtures Body:getContactList -> Body:getContacts Body:getJointList -> Body:getJoints Marked the old functions as deprecated --HG-- branch : minor
This commit is contained in:
@@ -427,7 +427,7 @@ World *Body::getWorld() const
|
||||
return world;
|
||||
}
|
||||
|
||||
int Body::getFixtureList(lua_State *L) const
|
||||
int Body::getFixtures(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
b2Fixture *f = body->GetFixtureList();
|
||||
@@ -447,7 +447,7 @@ int Body::getFixtureList(lua_State *L) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Body::getJointList(lua_State *L) const
|
||||
int Body::getJoints(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
const b2JointEdge *je = body->GetJointList();
|
||||
@@ -471,7 +471,7 @@ int Body::getJointList(lua_State *L) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Body::getContactList(lua_State *L) const
|
||||
int Body::getContacts(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
const b2ContactEdge *ce = body->GetContactList();
|
||||
|
||||
@@ -391,19 +391,19 @@ public:
|
||||
* Get an array of all the Fixtures attached to this Body.
|
||||
* @return An array of Fixtures.
|
||||
**/
|
||||
int getFixtureList(lua_State *L) const;
|
||||
int getFixtures(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all Joints attached to this Body.
|
||||
**/
|
||||
int getJointList(lua_State *L) const;
|
||||
int getJoints(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all active Contacts attached to this Body.
|
||||
* This list changes during World:update and you may miss some collisions
|
||||
* if you don't use the collision callbacks.
|
||||
**/
|
||||
int getContactList(lua_State *L) const;
|
||||
int getContacts(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Destroy this body.
|
||||
|
||||
@@ -461,7 +461,7 @@ int World::getContactCount() const
|
||||
return world->GetContactCount();
|
||||
}
|
||||
|
||||
int World::getBodyList(lua_State *L) const
|
||||
int World::getBodies(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
b2Body *b = world->GetBodyList();
|
||||
@@ -483,7 +483,7 @@ int World::getBodyList(lua_State *L) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int World::getJointList(lua_State *L) const
|
||||
int World::getJoints(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
b2Joint *j = world->GetJointList();
|
||||
@@ -501,7 +501,7 @@ int World::getJointList(lua_State *L) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
int World::getContactList(lua_State *L) const
|
||||
int World::getContacts(lua_State *L) const
|
||||
{
|
||||
lua_newtable(L);
|
||||
b2Contact *c = world->GetContactList();
|
||||
|
||||
@@ -245,19 +245,19 @@ public:
|
||||
* Get an array of all the Bodies in the World.
|
||||
* @return An array of Bodies.
|
||||
**/
|
||||
int getBodyList(lua_State *L) const;
|
||||
int getBodies(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all the Joints in the World.
|
||||
* @return An array of Joints.
|
||||
**/
|
||||
int getJointList(lua_State *L) const;
|
||||
int getJoints(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Get an array of all the Contacts in the World.
|
||||
* @return An array of Contacts.
|
||||
**/
|
||||
int getContactList(lua_State *L) const;
|
||||
int getContacts(lua_State *L) const;
|
||||
|
||||
/**
|
||||
* Gets the ground body.
|
||||
|
||||
@@ -530,30 +530,30 @@ int w_Body_getWorld(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Body_getFixtureList(lua_State *L)
|
||||
int w_Body_getFixtures(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int n = 0;
|
||||
luax_catchexcept(L, [&](){ n = t->getFixtureList(L); });
|
||||
luax_catchexcept(L, [&](){ n = t->getFixtures(L); });
|
||||
return n;
|
||||
}
|
||||
|
||||
int w_Body_getJointList(lua_State *L)
|
||||
int w_Body_getJoints(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int n = 0;
|
||||
luax_catchexcept(L, [&](){ n = t->getJointList(L); });
|
||||
luax_catchexcept(L, [&](){ n = t->getJoints(L); });
|
||||
return n;
|
||||
}
|
||||
|
||||
int w_Body_getContactList(lua_State *L)
|
||||
int w_Body_getContacts(lua_State *L)
|
||||
{
|
||||
Body *t = luax_checkbody(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int n = 0;
|
||||
luax_catchexcept(L, [&](){ n = t->getContactList(L); });
|
||||
luax_catchexcept(L, [&](){ n = t->getContacts(L); });
|
||||
return n;
|
||||
}
|
||||
|
||||
@@ -585,6 +585,24 @@ int w_Body_getUserData(lua_State *L)
|
||||
return t->getUserData(L);
|
||||
}
|
||||
|
||||
int w_Body_getFixtureList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "Body:getFixtureList", API_METHOD, DEPRECATED_RENAMED, "Body:getFixtures");
|
||||
return w_Body_getFixtures(L);
|
||||
}
|
||||
|
||||
int w_Body_getJointList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "Body:getJointList", API_METHOD, DEPRECATED_RENAMED, "Body:getJoints");
|
||||
return w_Body_getJoints(L);
|
||||
}
|
||||
|
||||
int w_Body_getContactList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "Body:getContactList", API_METHOD, DEPRECATED_RENAMED, "Body:getContacts");
|
||||
return w_Body_getContacts(L);
|
||||
}
|
||||
|
||||
static const luaL_Reg w_Body_functions[] =
|
||||
{
|
||||
{ "getX", w_Body_getX },
|
||||
@@ -638,13 +656,19 @@ static const luaL_Reg w_Body_functions[] =
|
||||
{ "setFixedRotation", w_Body_setFixedRotation },
|
||||
{ "isFixedRotation", w_Body_isFixedRotation },
|
||||
{ "getWorld", w_Body_getWorld },
|
||||
{ "getFixtureList", w_Body_getFixtureList },
|
||||
{ "getJointList", w_Body_getJointList },
|
||||
{ "getContactList", w_Body_getContactList },
|
||||
{ "getFixtures", w_Body_getFixtures },
|
||||
{ "getJoints", w_Body_getJoints },
|
||||
{ "getContacts", w_Body_getContacts },
|
||||
{ "destroy", w_Body_destroy },
|
||||
{ "isDestroyed", w_Body_isDestroyed },
|
||||
{ "setUserData", w_Body_setUserData },
|
||||
{ "getUserData", w_Body_getUserData },
|
||||
|
||||
// Deprectaed
|
||||
{ "getFixtureList", w_Body_getFixtureList },
|
||||
{ "getJointList", w_Body_getJointList },
|
||||
{ "getContactList", w_Body_getContactList },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -151,30 +151,30 @@ int w_World_getContactCount(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_World_getBodyList(lua_State *L)
|
||||
int w_World_getBodies(lua_State *L)
|
||||
{
|
||||
World *t = luax_checkworld(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int ret = 0;
|
||||
luax_catchexcept(L, [&](){ ret = t->getBodyList(L); });
|
||||
luax_catchexcept(L, [&](){ ret = t->getBodies(L); });
|
||||
return ret;
|
||||
}
|
||||
|
||||
int w_World_getJointList(lua_State *L)
|
||||
int w_World_getJoints(lua_State *L)
|
||||
{
|
||||
World *t = luax_checkworld(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int ret = 0;
|
||||
luax_catchexcept(L, [&](){ ret = t->getJointList(L); });
|
||||
luax_catchexcept(L, [&](){ ret = t->getJoints(L); });
|
||||
return ret;
|
||||
}
|
||||
|
||||
int w_World_getContactList(lua_State *L)
|
||||
int w_World_getContacts(lua_State *L)
|
||||
{
|
||||
World *t = luax_checkworld(L, 1);
|
||||
lua_remove(L, 1);
|
||||
int ret = 0;
|
||||
luax_catchexcept(L, [&](){ ret = t->getContactList(L); });
|
||||
luax_catchexcept(L, [&](){ ret = t->getContacts(L); });
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -208,6 +208,23 @@ int w_World_isDestroyed(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_World_getBodyList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "World:getBodyList", API_METHOD, DEPRECATED_RENAMED, "World:getBodies");
|
||||
return w_World_getBodies(L);
|
||||
}
|
||||
|
||||
int w_World_getJointList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "World:getJointList", API_METHOD, DEPRECATED_RENAMED, "World:getJoints");
|
||||
return w_World_getJoints(L);
|
||||
}
|
||||
|
||||
int w_World_getContactList(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "World:getContactList", API_METHOD, DEPRECATED_RENAMED, "World:getContacts");
|
||||
return w_World_getContacts(L);
|
||||
}
|
||||
|
||||
static const luaL_Reg w_World_functions[] =
|
||||
{
|
||||
@@ -225,13 +242,19 @@ static const luaL_Reg w_World_functions[] =
|
||||
{ "getBodyCount", w_World_getBodyCount },
|
||||
{ "getJointCount", w_World_getJointCount },
|
||||
{ "getContactCount", w_World_getContactCount },
|
||||
{ "getBodyList", w_World_getBodyList },
|
||||
{ "getJointList", w_World_getJointList },
|
||||
{ "getContactList", w_World_getContactList },
|
||||
{ "getBodies", w_World_getBodies },
|
||||
{ "getJoints", w_World_getJoints },
|
||||
{ "getContacts", w_World_getContacts },
|
||||
{ "queryBoundingBox", w_World_queryBoundingBox },
|
||||
{ "rayCast", w_World_rayCast },
|
||||
{ "destroy", w_World_destroy },
|
||||
{ "isDestroyed", w_World_isDestroyed },
|
||||
|
||||
// Deprecated
|
||||
{ "getBodyList", w_World_getBodyList },
|
||||
{ "getJointList", w_World_getJointList },
|
||||
{ "getContactList", w_World_getContactList },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user