mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Removed love.graphics.get/setPointStyle. ‘rough’ points are now the only possibility (resolves issue #581).
--HG-- branch : minor
This commit is contained in:
@@ -79,16 +79,6 @@ bool Graphics::getConstant(LineJoin in, const char *&out)
|
|||||||
return lineJoins.find(in, out);
|
return lineJoins.find(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Graphics::getConstant(const char *in, PointStyle &out)
|
|
||||||
{
|
|
||||||
return pointStyles.find(in, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Graphics::getConstant(PointStyle in, const char *&out)
|
|
||||||
{
|
|
||||||
return pointStyles.find(in, out);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Graphics::getConstant(const char *in, Support &out)
|
bool Graphics::getConstant(const char *in, Support &out)
|
||||||
{
|
{
|
||||||
return support.find(in, out);
|
return support.find(in, out);
|
||||||
@@ -156,14 +146,6 @@ StringMap<Graphics::LineJoin, Graphics::LINE_JOIN_MAX_ENUM>::Entry Graphics::lin
|
|||||||
|
|
||||||
StringMap<Graphics::LineJoin, Graphics::LINE_JOIN_MAX_ENUM> Graphics::lineJoins(Graphics::lineJoinEntries, sizeof(Graphics::lineJoinEntries));
|
StringMap<Graphics::LineJoin, Graphics::LINE_JOIN_MAX_ENUM> Graphics::lineJoins(Graphics::lineJoinEntries, sizeof(Graphics::lineJoinEntries));
|
||||||
|
|
||||||
StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM>::Entry Graphics::pointStyleEntries[] =
|
|
||||||
{
|
|
||||||
{ "smooth", Graphics::POINT_SMOOTH },
|
|
||||||
{ "rough", Graphics::POINT_ROUGH }
|
|
||||||
};
|
|
||||||
|
|
||||||
StringMap<Graphics::PointStyle, Graphics::POINT_MAX_ENUM> Graphics::pointStyles(Graphics::pointStyleEntries, sizeof(Graphics::pointStyleEntries));
|
|
||||||
|
|
||||||
StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] =
|
StringMap<Graphics::Support, Graphics::SUPPORT_MAX_ENUM>::Entry Graphics::supportEntries[] =
|
||||||
{
|
{
|
||||||
{ "canvas", Graphics::SUPPORT_CANVAS },
|
{ "canvas", Graphics::SUPPORT_CANVAS },
|
||||||
|
|||||||
@@ -76,13 +76,6 @@ public:
|
|||||||
LINE_JOIN_MAX_ENUM
|
LINE_JOIN_MAX_ENUM
|
||||||
};
|
};
|
||||||
|
|
||||||
enum PointStyle
|
|
||||||
{
|
|
||||||
POINT_ROUGH = 1,
|
|
||||||
POINT_SMOOTH,
|
|
||||||
POINT_MAX_ENUM
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Support
|
enum Support
|
||||||
{
|
{
|
||||||
SUPPORT_CANVAS = 1,
|
SUPPORT_CANVAS = 1,
|
||||||
@@ -141,9 +134,6 @@ public:
|
|||||||
static bool getConstant(const char *in, LineJoin &out);
|
static bool getConstant(const char *in, LineJoin &out);
|
||||||
static bool getConstant(LineJoin in, const char *&out);
|
static bool getConstant(LineJoin in, const char *&out);
|
||||||
|
|
||||||
static bool getConstant(const char *in, PointStyle &out);
|
|
||||||
static bool getConstant(PointStyle in, const char *&out);
|
|
||||||
|
|
||||||
static bool getConstant(const char *in, Support &out);
|
static bool getConstant(const char *in, Support &out);
|
||||||
static bool getConstant(Support in, const char *&out);
|
static bool getConstant(Support in, const char *&out);
|
||||||
|
|
||||||
@@ -167,9 +157,6 @@ private:
|
|||||||
static StringMap<LineJoin, LINE_JOIN_MAX_ENUM>::Entry lineJoinEntries[];
|
static StringMap<LineJoin, LINE_JOIN_MAX_ENUM>::Entry lineJoinEntries[];
|
||||||
static StringMap<LineJoin, LINE_JOIN_MAX_ENUM> lineJoins;
|
static StringMap<LineJoin, LINE_JOIN_MAX_ENUM> lineJoins;
|
||||||
|
|
||||||
static StringMap<PointStyle, POINT_MAX_ENUM>::Entry pointStyleEntries[];
|
|
||||||
static StringMap<PointStyle, POINT_MAX_ENUM> pointStyles;
|
|
||||||
|
|
||||||
static StringMap<Support, SUPPORT_MAX_ENUM>::Entry supportEntries[];
|
static StringMap<Support, SUPPORT_MAX_ENUM>::Entry supportEntries[];
|
||||||
static StringMap<Support, SUPPORT_MAX_ENUM> support;
|
static StringMap<Support, SUPPORT_MAX_ENUM> support;
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,6 @@ DisplayState Graphics::saveState()
|
|||||||
s.lineStyle = lineStyle;
|
s.lineStyle = lineStyle;
|
||||||
//get the point size
|
//get the point size
|
||||||
glGetFloatv(GL_POINT_SIZE, &s.pointSize);
|
glGetFloatv(GL_POINT_SIZE, &s.pointSize);
|
||||||
//get point style
|
|
||||||
s.pointStyle = (glIsEnabled(GL_POINT_SMOOTH) == GL_TRUE) ? Graphics::POINT_SMOOTH : Graphics::POINT_ROUGH;
|
|
||||||
//get scissor status
|
//get scissor status
|
||||||
s.scissor = (glIsEnabled(GL_SCISSOR_TEST) == GL_TRUE);
|
s.scissor = (glIsEnabled(GL_SCISSOR_TEST) == GL_TRUE);
|
||||||
//do we have scissor, if so, store the box
|
//do we have scissor, if so, store the box
|
||||||
@@ -108,7 +106,6 @@ void Graphics::restoreState(const DisplayState &s)
|
|||||||
setLineWidth(lineWidth);
|
setLineWidth(lineWidth);
|
||||||
setLineStyle(s.lineStyle);
|
setLineStyle(s.lineStyle);
|
||||||
setPointSize(s.pointSize);
|
setPointSize(s.pointSize);
|
||||||
setPointStyle(s.pointStyle);
|
|
||||||
if (s.scissor)
|
if (s.scissor)
|
||||||
setScissor(s.scissorBox.x, s.scissorBox.y, s.scissorBox.w, s.scissorBox.h);
|
setScissor(s.scissorBox.x, s.scissorBox.y, s.scissorBox.w, s.scissorBox.h);
|
||||||
else
|
else
|
||||||
@@ -689,14 +686,6 @@ void Graphics::setPointSize(float size)
|
|||||||
glPointSize((GLfloat)size);
|
glPointSize((GLfloat)size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Graphics::setPointStyle(Graphics::PointStyle style)
|
|
||||||
{
|
|
||||||
if (style == POINT_SMOOTH)
|
|
||||||
glEnable(GL_POINT_SMOOTH);
|
|
||||||
else // love::POINT_ROUGH
|
|
||||||
glDisable(GL_POINT_SMOOTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
float Graphics::getPointSize() const
|
float Graphics::getPointSize() const
|
||||||
{
|
{
|
||||||
GLfloat size;
|
GLfloat size;
|
||||||
@@ -704,14 +693,6 @@ float Graphics::getPointSize() const
|
|||||||
return (float)size;
|
return (float)size;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics::PointStyle Graphics::getPointStyle() const
|
|
||||||
{
|
|
||||||
if (glIsEnabled(GL_POINT_SMOOTH) == GL_TRUE)
|
|
||||||
return POINT_SMOOTH;
|
|
||||||
else
|
|
||||||
return POINT_ROUGH;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Graphics::getMaxPointSize() const
|
int Graphics::getMaxPointSize() const
|
||||||
{
|
{
|
||||||
GLint max;
|
GLint max;
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ struct DisplayState
|
|||||||
|
|
||||||
// Point.
|
// Point.
|
||||||
float pointSize;
|
float pointSize;
|
||||||
Graphics::PointStyle pointStyle;
|
|
||||||
|
|
||||||
// Scissor.
|
// Scissor.
|
||||||
bool scissor;
|
bool scissor;
|
||||||
@@ -90,7 +89,6 @@ struct DisplayState
|
|||||||
lineStyle = Graphics::LINE_SMOOTH;
|
lineStyle = Graphics::LINE_SMOOTH;
|
||||||
lineJoin = Graphics::LINE_JOIN_MITER;
|
lineJoin = Graphics::LINE_JOIN_MITER;
|
||||||
pointSize = 1.0f;
|
pointSize = 1.0f;
|
||||||
pointStyle = Graphics::POINT_SMOOTH;
|
|
||||||
scissor = false;
|
scissor = false;
|
||||||
colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
|
colorMask[0] = colorMask[1] = colorMask[2] = colorMask[3] = true;
|
||||||
}
|
}
|
||||||
@@ -320,22 +318,11 @@ public:
|
|||||||
**/
|
**/
|
||||||
void setPointSize(float size);
|
void setPointSize(float size);
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the style of points.
|
|
||||||
* @param style POINT_SMOOTH or POINT_ROUGH.
|
|
||||||
**/
|
|
||||||
void setPointStyle(PointStyle style);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the point size.
|
* Gets the point size.
|
||||||
**/
|
**/
|
||||||
float getPointSize() const;
|
float getPointSize() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the point style.
|
|
||||||
**/
|
|
||||||
PointStyle getPointStyle() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum point size supported.
|
* Gets the maximum point size supported.
|
||||||
* This may vary from computer to computer.
|
* This may vary from computer to computer.
|
||||||
|
|||||||
@@ -790,34 +790,12 @@ int w_setPointSize(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_setPointStyle(lua_State *L)
|
|
||||||
{
|
|
||||||
Graphics::PointStyle style;
|
|
||||||
|
|
||||||
const char *str = luaL_checkstring(L, 1);
|
|
||||||
if (!Graphics::getConstant(str, style))
|
|
||||||
return luaL_error(L, "Invalid point style: %s", str);
|
|
||||||
|
|
||||||
instance->setPointStyle(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());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int w_getPointStyle(lua_State *L)
|
|
||||||
{
|
|
||||||
Graphics::PointStyle style = instance->getPointStyle();
|
|
||||||
const char *str;
|
|
||||||
if (!Graphics::getConstant(style, str))
|
|
||||||
return luaL_error(L, "Unknown point style");
|
|
||||||
lua_pushstring(L, str);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int w_getMaxPointSize(lua_State *L)
|
int w_getMaxPointSize(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_pushnumber(L, instance->getMaxPointSize());
|
lua_pushnumber(L, instance->getMaxPointSize());
|
||||||
@@ -1344,9 +1322,7 @@ static const luaL_Reg functions[] =
|
|||||||
{ "getLineStyle", w_getLineStyle },
|
{ "getLineStyle", w_getLineStyle },
|
||||||
{ "getLineJoin", w_getLineJoin },
|
{ "getLineJoin", w_getLineJoin },
|
||||||
{ "setPointSize", w_setPointSize },
|
{ "setPointSize", w_setPointSize },
|
||||||
{ "setPointStyle", w_setPointStyle },
|
|
||||||
{ "getPointSize", w_getPointSize },
|
{ "getPointSize", w_getPointSize },
|
||||||
{ "getPointStyle", w_getPointStyle },
|
|
||||||
{ "getMaxPointSize", w_getMaxPointSize },
|
{ "getMaxPointSize", w_getMaxPointSize },
|
||||||
{ "getMaxTextureSize", w_getMaxTextureSize },
|
{ "getMaxTextureSize", w_getMaxTextureSize },
|
||||||
{ "newScreenshot", w_newScreenshot },
|
{ "newScreenshot", w_newScreenshot },
|
||||||
|
|||||||
@@ -81,9 +81,7 @@ int w_getLineWidth(lua_State *L);
|
|||||||
int w_getLineStyle(lua_State *L);
|
int w_getLineStyle(lua_State *L);
|
||||||
int w_getLineJoin(lua_State *L);
|
int w_getLineJoin(lua_State *L);
|
||||||
int w_setPointSize(lua_State *L);
|
int w_setPointSize(lua_State *L);
|
||||||
int w_setPointStyle(lua_State *L);
|
|
||||||
int w_getPointSize(lua_State *L);
|
int w_getPointSize(lua_State *L);
|
||||||
int w_getPointStyle(lua_State *L);
|
|
||||||
int w_getMaxPointSize(lua_State *L);
|
int w_getMaxPointSize(lua_State *L);
|
||||||
int w_newScreenshot(lua_State *L);
|
int w_newScreenshot(lua_State *L);
|
||||||
int w_setCanvas(lua_State *L);
|
int w_setCanvas(lua_State *L);
|
||||||
|
|||||||
Reference in New Issue
Block a user