Commits

Alex Szpakowski committed 4d2e148

Merged love.graphics.setCanvases into love.graphics.setCanvas (resolves issue #684)

Comments (0)

Files changed (2)

src/modules/graphics/opengl/wrap_Graphics.cpp

 		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<Canvas *> attachments;
 
 
 	try
 	{
-		canvas->startGrab(attachments);
+		if (attachments.size() > 0)
+			canvas->startGrab(attachments);
+		else
+			canvas->startGrab();
 	}
 	catch (love::Exception &e)
 	{
 	{ "getMaxImageSize", w_getMaxImageSize },
 	{ "newScreenshot", w_newScreenshot },
 	{ "setCanvas", w_setCanvas },
-	{ "setCanvases", w_setCanvases },
 	{ "getCanvas", w_getCanvas },
-	{ "getCanvases", w_getCanvas },
 
 	{ "setShader", w_setShader },
 	{ "getShader", w_getShader },

src/modules/graphics/opengl/wrap_Graphics.h

 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);