mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Removed newWorld(w, h). Added newWorld(x1, y1, x2, y2).
This commit is contained in:
@@ -31,44 +31,22 @@ namespace box2d
|
||||
|
||||
int w_newWorld(lua_State * L)
|
||||
{
|
||||
int top = lua_gettop(L);
|
||||
if (top == 2)
|
||||
{
|
||||
float x = (float)luaL_checknumber(L, 1);
|
||||
float y = (float)luaL_checknumber(L, 2);
|
||||
World * w = instance->newWorld(x, y);
|
||||
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
|
||||
return 1;
|
||||
}
|
||||
else if (top == 6 || top == 7)
|
||||
{
|
||||
float lx = (float)luaL_checknumber(L, 1);
|
||||
float ly = (float)luaL_checknumber(L, 2);
|
||||
float ux = (float)luaL_checknumber(L, 3);
|
||||
float uy = (float)luaL_checknumber(L, 4);
|
||||
float gx = (float)luaL_checknumber(L, 5);
|
||||
float gy = (float)luaL_checknumber(L, 6);
|
||||
bool sleep = luax_optboolean(L, 7, true);
|
||||
World * w = instance->newWorld(lx, ly, ux, uy, gx, gy, sleep);
|
||||
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
|
||||
return 1;
|
||||
}
|
||||
else if (top == 8)
|
||||
{
|
||||
float lx = (float)luaL_checknumber(L, 1);
|
||||
float ly = (float)luaL_checknumber(L, 2);
|
||||
float ux = (float)luaL_checknumber(L, 3);
|
||||
float uy = (float)luaL_checknumber(L, 4);
|
||||
float gx = (float)luaL_checknumber(L, 5);
|
||||
float gy = (float)luaL_checknumber(L, 6);
|
||||
bool sleep = lua_toboolean(L, 7);
|
||||
int meter = (int)luaL_checknumber(L, 8);
|
||||
World * w = instance->newWorld(lx, ly, ux, uy, gx, gy, sleep, meter);
|
||||
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
if (lua_gettop(L) < 4)
|
||||
return luaL_error(L, "Incorrect number of parameters");
|
||||
|
||||
float lx = (float)luaL_checknumber(L, 1);
|
||||
float ly = (float)luaL_checknumber(L, 2);
|
||||
float ux = (float)luaL_checknumber(L, 3);
|
||||
float uy = (float)luaL_checknumber(L, 4);
|
||||
float gx = (float)luaL_optnumber(L, 5, 0);
|
||||
float gy = (float)luaL_optnumber(L, 6, 0);
|
||||
bool sleep = luax_optboolean(L, 7, true);
|
||||
int meter = (int)luaL_optnumber(L, 8, World::DEFAULT_METER);
|
||||
|
||||
World * w = instance->newWorld(lx, ly, ux, uy, gx, gy, sleep, meter);
|
||||
luax_newtype(L, "World", PHYSICS_WORLD_T, (void*)w);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_newBody(lua_State * L)
|
||||
|
||||
Reference in New Issue
Block a user