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:
Alex Szpakowski
2013-06-14 10:12:09 -03:00
parent 5d2b20a662
commit 0a1c90f2d7
4 changed files with 4 additions and 70 deletions
+4 -21
View File
@@ -109,8 +109,10 @@ void Graphics::restoreState(const DisplayState &s)
setColor(s.color); setColor(s.color);
setBackgroundColor(s.backgroundColor); setBackgroundColor(s.backgroundColor);
setBlendMode(s.blendMode); setBlendMode(s.blendMode);
setLine(lineWidth, s.lineStyle); setLineWidth(lineWidth);
setPoint(s.pointSize, s.pointStyle); setLineStyle(s.lineStyle);
setPointSize(s.pointSize);
setPointStyle(s.pointStyle);
if (s.alphaTest) if (s.alphaTest)
setAlphaTest(s.alphaTestMode, s.alphaTestRef); setAlphaTest(s.alphaTestMode, s.alphaTestRef);
else else
@@ -730,15 +732,6 @@ void Graphics::setLineStyle(Graphics::LineStyle style)
lineStyle = style; lineStyle = style;
} }
void Graphics::setLine(float width, Graphics::LineStyle style)
{
setLineWidth(width);
if (style == 0)
return;
setLineStyle(style);
}
float Graphics::getLineWidth() const float Graphics::getLineWidth() const
{ {
return lineWidth; return lineWidth;
@@ -762,16 +755,6 @@ void Graphics::setPointStyle(Graphics::PointStyle style)
glDisable(GL_POINT_SMOOTH); 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 float Graphics::getPointSize() const
{ {
GLfloat size; GLfloat size;
-11
View File
@@ -325,12 +325,6 @@ public:
**/ **/
void setLineStyle(LineStyle style); 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. * Gets the line width.
**/ **/
@@ -352,11 +346,6 @@ public:
**/ **/
void setPointStyle(PointStyle style); void setPointStyle(PointStyle style);
/**
* Shorthand for setPointSize and setPointStyle.
**/
void setPoint(float size, PointStyle style);
/** /**
* Gets the point size. * Gets the point size.
**/ **/
@@ -779,23 +779,6 @@ int w_setLineStyle(lua_State *L)
return 0; 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) int w_getLineWidth(lua_State *L)
{ {
lua_pushnumber(L, instance->getLineWidth()); lua_pushnumber(L, instance->getLineWidth());
@@ -831,23 +814,6 @@ int w_setPointStyle(lua_State *L)
return 0; 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) int w_getPointSize(lua_State *L)
{ {
lua_pushnumber(L, instance->getPointSize()); lua_pushnumber(L, instance->getPointSize());
@@ -1473,12 +1439,10 @@ static const luaL_Reg functions[] =
{ "getDefaultMipmapFilter", w_getDefaultMipmapFilter }, { "getDefaultMipmapFilter", w_getDefaultMipmapFilter },
{ "setLineWidth", w_setLineWidth }, { "setLineWidth", w_setLineWidth },
{ "setLineStyle", w_setLineStyle }, { "setLineStyle", w_setLineStyle },
{ "setLine", w_setLine },
{ "getLineWidth", w_getLineWidth }, { "getLineWidth", w_getLineWidth },
{ "getLineStyle", w_getLineStyle }, { "getLineStyle", w_getLineStyle },
{ "setPointSize", w_setPointSize }, { "setPointSize", w_setPointSize },
{ "setPointStyle", w_setPointStyle }, { "setPointStyle", w_setPointStyle },
{ "setPoint", w_setPoint },
{ "getPointSize", w_getPointSize }, { "getPointSize", w_getPointSize },
{ "getPointStyle", w_getPointStyle }, { "getPointStyle", w_getPointStyle },
{ "getMaxPointSize", w_getMaxPointSize }, { "getMaxPointSize", w_getMaxPointSize },
@@ -75,12 +75,10 @@ int w_setDefaultMipmapFilter(lua_State *L);
int w_getDefaultMipmapFilter(lua_State *L); int w_getDefaultMipmapFilter(lua_State *L);
int w_setLineWidth(lua_State *L); int w_setLineWidth(lua_State *L);
int w_setLineStyle(lua_State *L); int w_setLineStyle(lua_State *L);
int w_setLine(lua_State *L);
int w_getLineWidth(lua_State *L); int w_getLineWidth(lua_State *L);
int w_getLineStyle(lua_State *L); int w_getLineStyle(lua_State *L);
int w_setPointSize(lua_State *L); int w_setPointSize(lua_State *L);
int w_setPointStyle(lua_State *L); int w_setPointStyle(lua_State *L);
int w_setPoint(lua_State *L);
int w_getPointSize(lua_State *L); int w_getPointSize(lua_State *L);
int w_getPointStyle(lua_State *L); int w_getPointStyle(lua_State *L);
int w_getMaxPointSize(lua_State *L); int w_getMaxPointSize(lua_State *L);