mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Removed love.graphics.setLine and love.graphics.setPoint.
Both functions are redundant (setLineStyle+setLineWidth and setPointStyle+setPointSize do the same thing) and have misleading names.
This commit is contained in:
@@ -109,8 +109,10 @@ void Graphics::restoreState(const DisplayState &s)
|
||||
setColor(s.color);
|
||||
setBackgroundColor(s.backgroundColor);
|
||||
setBlendMode(s.blendMode);
|
||||
setLine(lineWidth, s.lineStyle);
|
||||
setPoint(s.pointSize, s.pointStyle);
|
||||
setLineWidth(lineWidth);
|
||||
setLineStyle(s.lineStyle);
|
||||
setPointSize(s.pointSize);
|
||||
setPointStyle(s.pointStyle);
|
||||
if (s.alphaTest)
|
||||
setAlphaTest(s.alphaTestMode, s.alphaTestRef);
|
||||
else
|
||||
@@ -730,15 +732,6 @@ void Graphics::setLineStyle(Graphics::LineStyle style)
|
||||
lineStyle = style;
|
||||
}
|
||||
|
||||
void Graphics::setLine(float width, Graphics::LineStyle style)
|
||||
{
|
||||
setLineWidth(width);
|
||||
|
||||
if (style == 0)
|
||||
return;
|
||||
setLineStyle(style);
|
||||
}
|
||||
|
||||
float Graphics::getLineWidth() const
|
||||
{
|
||||
return lineWidth;
|
||||
@@ -762,16 +755,6 @@ void Graphics::setPointStyle(Graphics::PointStyle style)
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
}
|
||||
|
||||
void Graphics::setPoint(float size, Graphics::PointStyle style)
|
||||
{
|
||||
if (style == POINT_SMOOTH)
|
||||
glEnable(GL_POINT_SMOOTH);
|
||||
else // POINT_ROUGH
|
||||
glDisable(GL_POINT_SMOOTH);
|
||||
|
||||
glPointSize((GLfloat)size);
|
||||
}
|
||||
|
||||
float Graphics::getPointSize() const
|
||||
{
|
||||
GLfloat size;
|
||||
|
||||
@@ -325,12 +325,6 @@ public:
|
||||
**/
|
||||
void setLineStyle(LineStyle style);
|
||||
|
||||
/**
|
||||
* Sets the type of line used to draw primitives.
|
||||
* A shorthand for setLineWidth and setLineStyle.
|
||||
**/
|
||||
void setLine(float width, LineStyle style);
|
||||
|
||||
/**
|
||||
* Gets the line width.
|
||||
**/
|
||||
@@ -352,11 +346,6 @@ public:
|
||||
**/
|
||||
void setPointStyle(PointStyle style);
|
||||
|
||||
/**
|
||||
* Shorthand for setPointSize and setPointStyle.
|
||||
**/
|
||||
void setPoint(float size, PointStyle style);
|
||||
|
||||
/**
|
||||
* Gets the point size.
|
||||
**/
|
||||
|
||||
@@ -779,23 +779,6 @@ int w_setLineStyle(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_setLine(lua_State *L)
|
||||
{
|
||||
float width = (float)luaL_checknumber(L, 1);
|
||||
|
||||
Graphics::LineStyle style = Graphics::LINE_SMOOTH;
|
||||
|
||||
if (lua_gettop(L) >= 2)
|
||||
{
|
||||
const char *str = luaL_checkstring(L, 2);
|
||||
if (!Graphics::getConstant(str, style))
|
||||
return luaL_error(L, "Invalid line style: %s", str);
|
||||
}
|
||||
|
||||
instance->setLine(width, style);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_getLineWidth(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, instance->getLineWidth());
|
||||
@@ -831,23 +814,6 @@ int w_setPointStyle(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_setPoint(lua_State *L)
|
||||
{
|
||||
float size = (float)luaL_checknumber(L, 1);
|
||||
|
||||
Graphics::PointStyle style = Graphics::POINT_SMOOTH;
|
||||
|
||||
if (lua_gettop(L) >= 2)
|
||||
{
|
||||
const char *str = luaL_checkstring(L, 2);
|
||||
if (!Graphics::getConstant(str, style))
|
||||
return luaL_error(L, "Invalid point style: %s", str);
|
||||
}
|
||||
|
||||
instance->setPoint(size, style);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_getPointSize(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, instance->getPointSize());
|
||||
@@ -1473,12 +1439,10 @@ static const luaL_Reg functions[] =
|
||||
{ "getDefaultMipmapFilter", w_getDefaultMipmapFilter },
|
||||
{ "setLineWidth", w_setLineWidth },
|
||||
{ "setLineStyle", w_setLineStyle },
|
||||
{ "setLine", w_setLine },
|
||||
{ "getLineWidth", w_getLineWidth },
|
||||
{ "getLineStyle", w_getLineStyle },
|
||||
{ "setPointSize", w_setPointSize },
|
||||
{ "setPointStyle", w_setPointStyle },
|
||||
{ "setPoint", w_setPoint },
|
||||
{ "getPointSize", w_getPointSize },
|
||||
{ "getPointStyle", w_getPointStyle },
|
||||
{ "getMaxPointSize", w_getMaxPointSize },
|
||||
|
||||
@@ -75,12 +75,10 @@ int w_setDefaultMipmapFilter(lua_State *L);
|
||||
int w_getDefaultMipmapFilter(lua_State *L);
|
||||
int w_setLineWidth(lua_State *L);
|
||||
int w_setLineStyle(lua_State *L);
|
||||
int w_setLine(lua_State *L);
|
||||
int w_getLineWidth(lua_State *L);
|
||||
int w_getLineStyle(lua_State *L);
|
||||
int w_setPointSize(lua_State *L);
|
||||
int w_setPointStyle(lua_State *L);
|
||||
int w_setPoint(lua_State *L);
|
||||
int w_getPointSize(lua_State *L);
|
||||
int w_getPointStyle(lua_State *L);
|
||||
int w_getMaxPointSize(lua_State *L);
|
||||
|
||||
Reference in New Issue
Block a user