From cb0a97454699afb9e3955ea0a4068c7db8a2ef14 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Fri, 19 Jul 2013 15:45:40 -0300 Subject: [PATCH] Merged love.graphics.setCanvases into love.graphics.setCanvas (resolves issue #684) --- src/modules/graphics/opengl/wrap_Graphics.cpp | 35 +++---------------- src/modules/graphics/opengl/wrap_Graphics.h | 1 - 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 6e0c719be..a570cf3d8 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -970,34 +970,6 @@ int w_setCanvas(lua_State *L) return 0; } - Canvas *canvas = luax_checkcanvas(L, 1); - - try - { - // this unbinds the previous fbo - canvas->startGrab(); - } - catch (love::Exception &e) - { - return luaL_error(L, "%s", e.what()); - } - - return 0; -} - -int w_setCanvases(lua_State *L) -{ - // discard stencil testing - instance->discardStencil(); - - // called with none -> reset to default buffer - // nil is an error, to help people with typoes - if (lua_isnone(L,1)) - { - Canvas::bindDefaultCanvas(); - return 0; - } - bool is_table = lua_istable(L, 1); std::vector attachments; @@ -1026,7 +998,10 @@ int w_setCanvases(lua_State *L) try { - canvas->startGrab(attachments); + if (attachments.size() > 0) + canvas->startGrab(attachments); + else + canvas->startGrab(); } catch (love::Exception &e) { @@ -1529,9 +1504,7 @@ static const luaL_Reg functions[] = { "getMaxImageSize", w_getMaxImageSize }, { "newScreenshot", w_newScreenshot }, { "setCanvas", w_setCanvas }, - { "setCanvases", w_setCanvases }, { "getCanvas", w_getCanvas }, - { "getCanvases", w_getCanvas }, { "setShader", w_setShader }, { "getShader", w_getShader }, diff --git a/src/modules/graphics/opengl/wrap_Graphics.h b/src/modules/graphics/opengl/wrap_Graphics.h index a521b7f9f..e55b7d91a 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.h +++ b/src/modules/graphics/opengl/wrap_Graphics.h @@ -85,7 +85,6 @@ int w_getPointStyle(lua_State *L); int w_getMaxPointSize(lua_State *L); int w_newScreenshot(lua_State *L); int w_setCanvas(lua_State *L); -int w_setCanvases(lua_State *L); int w_getCanvas(lua_State *L); int w_setShader(lua_State *L); int w_getShader(lua_State *L);