From f0ca4f6c97ff22564869c04e72130d5db7d88b53 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sun, 3 Mar 2013 18:49:56 -0400 Subject: [PATCH] Removed internal code for love.graphics.triangle and love.graphics.quad --- src/modules/graphics/opengl/Graphics.cpp | 15 +------- src/modules/graphics/opengl/Graphics.h | 26 ------------- src/modules/graphics/opengl/wrap_Graphics.cpp | 38 ------------------- src/modules/graphics/opengl/wrap_Graphics.h | 2 - 4 files changed, 2 insertions(+), 79 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index cf365c633..4a3376017 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -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) diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 6264853cb..50a40540a 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -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). diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 3d4e639dd..356462daa 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -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 }, diff --git a/src/modules/graphics/opengl/wrap_Graphics.h b/src/modules/graphics/opengl/wrap_Graphics.h index d11ac1552..fa934bcfb 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.h +++ b/src/modules/graphics/opengl/wrap_Graphics.h @@ -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);