mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Error if the rx and ry parameters of love.graphics.rectangle are >= half the rectangle's width or height, respectively.
This commit is contained in:
@@ -1535,6 +1535,11 @@ int w_rectangle(lua_State *L)
|
|||||||
float rx = (float)luaL_optnumber(L, 6, 0.0);
|
float rx = (float)luaL_optnumber(L, 6, 0.0);
|
||||||
float ry = (float)luaL_optnumber(L, 7, rx);
|
float ry = (float)luaL_optnumber(L, 7, rx);
|
||||||
|
|
||||||
|
if (rx >= w / 2.0)
|
||||||
|
return luaL_error(L, "Invalid rectangle x-axis radius (must be less than half the width)");
|
||||||
|
if (ry >= h / 2.0)
|
||||||
|
return luaL_error(L, "Invalid rectangle y-axis radius (must be less than half the height)");
|
||||||
|
|
||||||
int points;
|
int points;
|
||||||
if (lua_isnoneornil(L, 8))
|
if (lua_isnoneornil(L, 8))
|
||||||
points = rx + ry > 20 ? (int)((rx + ry) / 4) : 10;
|
points = rx + ry > 20 ? (int)((rx + ry) / 4) : 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user