mirror of
https://github.com/love2d/love.git
synced 2026-08-19 04:06:17 +02:00
Add World:isLocked and const-ify a few worthy methods
--HG-- branch : box2d-update
This commit is contained in:
@@ -341,23 +341,28 @@ namespace box2d
|
|||||||
{
|
{
|
||||||
return world->GetAllowSleeping();
|
return world->GetAllowSleeping();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool World::isLocked() const
|
||||||
|
{
|
||||||
|
return world->IsLocked();
|
||||||
|
}
|
||||||
|
|
||||||
int World::getBodyCount()
|
int World::getBodyCount() const
|
||||||
{
|
{
|
||||||
return world->GetBodyCount();
|
return world->GetBodyCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getJointCount()
|
int World::getJointCount() const
|
||||||
{
|
{
|
||||||
return world->GetJointCount();
|
return world->GetJointCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getContactCount()
|
int World::getContactCount() const
|
||||||
{
|
{
|
||||||
return world->GetContactCount();
|
return world->GetContactCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getBodyList(lua_State * L)
|
int World::getBodyList(lua_State * L) const
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
b2Body * b = world->GetBodyList();
|
b2Body * b = world->GetBodyList();
|
||||||
@@ -372,7 +377,7 @@ namespace box2d
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getJointList(lua_State * L)
|
int World::getJointList(lua_State * L) const
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
b2Joint * j = world->GetJointList();
|
b2Joint * j = world->GetJointList();
|
||||||
@@ -387,7 +392,7 @@ namespace box2d
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int World::getContactList(lua_State * L)
|
int World::getContactList(lua_State * L) const
|
||||||
{
|
{
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
b2Contact * c = world->GetContactList();
|
b2Contact * c = world->GetContactList();
|
||||||
@@ -402,7 +407,7 @@ namespace box2d
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
b2Body * World::getGroundBody()
|
b2Body * World::getGroundBody() const
|
||||||
{
|
{
|
||||||
return groundBody;
|
return groundBody;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,48 +202,55 @@ namespace box2d
|
|||||||
* @return True if allowed, false if disallowed.
|
* @return True if allowed, false if disallowed.
|
||||||
**/
|
**/
|
||||||
bool getAllowSleeping() const;
|
bool getAllowSleeping() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this World is currently locked.
|
||||||
|
* If it's locked, it's in the middle of a timestep.
|
||||||
|
* @return Whether the World is locked.
|
||||||
|
**/
|
||||||
|
bool isLocked() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current body count.
|
* Get the current body count.
|
||||||
* @return The number of bodies.
|
* @return The number of bodies.
|
||||||
**/
|
**/
|
||||||
int getBodyCount();
|
int getBodyCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current joint count.
|
* Get the current joint count.
|
||||||
* @return The number of joints.
|
* @return The number of joints.
|
||||||
**/
|
**/
|
||||||
int getJointCount();
|
int getJointCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current contact count.
|
* Get the current contact count.
|
||||||
* @return The number of contacts.
|
* @return The number of contacts.
|
||||||
**/
|
**/
|
||||||
int getContactCount();
|
int getContactCount() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of all the Bodies in the World.
|
* Get an array of all the Bodies in the World.
|
||||||
* @return An array of Bodies.
|
* @return An array of Bodies.
|
||||||
**/
|
**/
|
||||||
int getBodyList(lua_State * L);
|
int getBodyList(lua_State * L) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of all the Joints in the World.
|
* Get an array of all the Joints in the World.
|
||||||
* @return An array of Joints.
|
* @return An array of Joints.
|
||||||
**/
|
**/
|
||||||
int getJointList(lua_State * L);
|
int getJointList(lua_State * L) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of all the Contacts in the World.
|
* Get an array of all the Contacts in the World.
|
||||||
* @return An array of Contacts.
|
* @return An array of Contacts.
|
||||||
**/
|
**/
|
||||||
int getContactList(lua_State * L);
|
int getContactList(lua_State * L) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ground body.
|
* Gets the ground body.
|
||||||
* @return The ground body.
|
* @return The ground body.
|
||||||
**/
|
**/
|
||||||
b2Body * getGroundBody();
|
b2Body * getGroundBody() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all fixtures that overlap a given bounding box.
|
* Gets all fixtures that overlap a given bounding box.
|
||||||
|
|||||||
@@ -98,6 +98,13 @@ namespace box2d
|
|||||||
luax_pushboolean(L, t->getAllowSleeping());
|
luax_pushboolean(L, t->getAllowSleeping());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_World_isLocked(lua_State * L)
|
||||||
|
{
|
||||||
|
World * t = luax_checkworld(L, 1);
|
||||||
|
luax_pushboolean(L, t->isLocked());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int w_World_getBodyCount(lua_State * L)
|
int w_World_getBodyCount(lua_State * L)
|
||||||
{
|
{
|
||||||
@@ -165,6 +172,7 @@ namespace box2d
|
|||||||
{ "getGravity", w_World_getGravity },
|
{ "getGravity", w_World_getGravity },
|
||||||
{ "setAllowSleeping", w_World_setAllowSleeping },
|
{ "setAllowSleeping", w_World_setAllowSleeping },
|
||||||
{ "getAllowSleeping", w_World_getAllowSleeping },
|
{ "getAllowSleeping", w_World_getAllowSleeping },
|
||||||
|
{ "isLocked", w_World_isLocked },
|
||||||
{ "getBodyCount", w_World_getBodyCount },
|
{ "getBodyCount", w_World_getBodyCount },
|
||||||
{ "getJointCount", w_World_getJointCount },
|
{ "getJointCount", w_World_getJointCount },
|
||||||
{ "getContactCount", w_World_getContactCount },
|
{ "getContactCount", w_World_getContactCount },
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace box2d
|
|||||||
int w_World_getGravity(lua_State * L);
|
int w_World_getGravity(lua_State * L);
|
||||||
int w_World_setAllowSleeping(lua_State * L);
|
int w_World_setAllowSleeping(lua_State * L);
|
||||||
int w_World_getAllowSleeping(lua_State * L);
|
int w_World_getAllowSleeping(lua_State * L);
|
||||||
|
int w_World_isLocked(lua_State * L);
|
||||||
int w_World_getBodyCount(lua_State * L);
|
int w_World_getBodyCount(lua_State * L);
|
||||||
int w_World_getJointCount(lua_State * L);
|
int w_World_getJointCount(lua_State * L);
|
||||||
int w_World_getContactCount(lua_State * L);
|
int w_World_getContactCount(lua_State * L);
|
||||||
|
|||||||
Reference in New Issue
Block a user