Removed internal code for love.graphics.triangle and love.graphics.quad

This commit is contained in:
Alex Szpakowski
2013-03-03 18:49:56 -04:00
parent 0efdc732e0
commit f0ca4f6c97
4 changed files with 2 additions and 79 deletions
+2 -13
View File
@@ -1003,21 +1003,10 @@ void Graphics::polyline(const float *coords, size_t count)
delete[] overdraw;
}
void Graphics::triangle(DrawMode mode, float x1, float y1, float x2, float y2, float x3, float y3)
{
float coords[] = { x1,y1, x2,y2, x3,y3, x1,y1 };
polygon(mode, coords, 4 * 2);
}
void Graphics::rectangle(DrawMode mode, float x, float y, float w, float h)
{
quad(mode, x,y, x,y+h, x+w,y+h, x+w,y);
}
void Graphics::quad(DrawMode mode, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
{
float coords[] = { x1,y1, x2,y2, x3,y3, x4,y4, x1,y1 };
polygon(mode, coords, 5 * 2);
float coords[] = {x,y, x,y+h, x+w,y+h, x+w,y};
polygon(mode, coords, 4 * 2);
}
void Graphics::circle(DrawMode mode, float x, float y, float radius, int points)
-26
View File
@@ -431,18 +431,6 @@ public:
**/
void polyline(const float *coords, size_t count);
/**
* Draws a triangle using the three coordinates passed.
* @param mode The mode of drawing (line/filled).
* @param x1 First x-coordinate.
* @param y1 First y-coordinate.
* @param x2 Second x-coordinate.
* @param y2 Second y-coordinate.
* @param x3 Third x-coordinate.
* @param y3 Third y-coordinate.
**/
void triangle(DrawMode mode, float x1, float y1, float x2, float y2, float x3, float y3);
/**
* Draws a rectangle.
* @param x Position along x-axis for top-left corner.
@@ -452,20 +440,6 @@ public:
**/
void rectangle(DrawMode mode, float x, float y, float w, float h);
/**
* Draws a quadrilateral using the four coordinates passed.
* @param mode The mode of drawing (line/filled).
* @param x1 First x-coordinate.
* @param y1 First y-coordinate.
* @param x2 Second x-coordinate.
* @param y2 Second y-coordinate.
* @param x3 Third x-coordinate.
* @param y3 Third y-coordinate.
* @param x4 Fourth x-coordinate.
* @param y4 Fourth y-coordinate.
**/
void quad(DrawMode mode, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4);
/**
* Draws a circle using the specified arguments.
* @param mode The mode of drawing (line/filled).
@@ -1121,23 +1121,6 @@ int w_line(lua_State *L)
return 0;
}
int w_triangle(lua_State *L)
{
Graphics::DrawMode mode;
const char *str = luaL_checkstring(L, 1);
if (!Graphics::getConstant(str, mode))
return luaL_error(L, "Incorrect draw mode %s", str);
float x1 = (float)luaL_checknumber(L, 2);
float y1 = (float)luaL_checknumber(L, 3);
float x2 = (float)luaL_checknumber(L, 4);
float y2 = (float)luaL_checknumber(L, 5);
float x3 = (float)luaL_checknumber(L, 6);
float y3 = (float)luaL_checknumber(L, 7);
instance->triangle(mode, x1, y1, x2, y2, x3, y3);
return 0;
}
int w_rectangle(lua_State *L)
{
Graphics::DrawMode mode;
@@ -1153,25 +1136,6 @@ int w_rectangle(lua_State *L)
return 0;
}
int w_quad(lua_State *L)
{
Graphics::DrawMode mode;
const char *str = luaL_checkstring(L, 1);
if (!Graphics::getConstant(str, mode))
return luaL_error(L, "Incorrect draw mode %s", str);
float x1 = (float)luaL_checknumber(L, 2);
float y1 = (float)luaL_checknumber(L, 3);
float x2 = (float)luaL_checknumber(L, 4);
float y2 = (float)luaL_checknumber(L, 5);
float x3 = (float)luaL_checknumber(L, 6);
float y3 = (float)luaL_checknumber(L, 7);
float x4 = (float)luaL_checknumber(L, 8);
float y4 = (float)luaL_checknumber(L, 9);
instance->quad(mode, x1, y1, x2, y2, x3, y3, x4, y4);
return 0;
}
int w_circle(lua_State *L)
{
Graphics::DrawMode mode;
@@ -1408,9 +1372,7 @@ static const luaL_Reg functions[] =
{ "point", w_point },
{ "line", w_line },
//{ "triangle", w_triangle },
{ "rectangle", w_rectangle },
//{ "quad", w_quad },
{ "circle", w_circle },
{ "arc", w_arc },
@@ -99,9 +99,7 @@ int w_print(lua_State *L);
int w_printf(lua_State *L);
int w_point(lua_State *L);
int w_line(lua_State *L);
int w_triangle(lua_State *L);
int w_rectangle(lua_State *L);
int w_quad(lua_State *L);
int w_circle(lua_State *L);
int w_arc(lua_State *L);
int w_push(lua_State *L);