Source

love / src / modules / graphics / opengl / wrap_Framebuffer.cpp

Diff from to

src/modules/graphics/opengl/wrap_Framebuffer.cpp

+#include "Graphics.h"
 #include "wrap_Framebuffer.h"
 
 namespace love
 		return 2;
 	}
 
+	int w_Framebuffer_clear(lua_State * L)
+	{
+		Framebuffer * fbo = luax_checkfbo(L, 1);
+		Color c;
+		if (lua_isnoneornil(L, 2)) {
+			c.r = 0;
+			c.g = 0;
+			c.b = 0;
+			c.a = 0;
+		} else if (lua_istable(L, 2)) {
+			lua_pushinteger(L, 1);
+			lua_gettable(L, 2);
+			c.r = (unsigned char)luaL_checkint(L, -1);
+			lua_pushinteger(L, 2);
+			lua_gettable(L, 2);
+			c.g = (unsigned char)luaL_checkint(L, -1);
+			lua_pushinteger(L, 3);
+			lua_gettable(L, 2);
+			c.b = (unsigned char)luaL_checkint(L, -1);
+			lua_pushinteger(L, 4);
+			lua_gettable(L, 2);
+			c.g = (unsigned char)luaL_optint(L, -1, 255);
+			lua_pop(L, 4);
+		} else {
+			c.r = (unsigned char)luaL_checkint(L, 2);
+			c.g = (unsigned char)luaL_checkint(L, 3);
+			c.b = (unsigned char)luaL_checkint(L, 4);
+			c.a = (unsigned char)luaL_optint(L, 5, 255);
+		}
+		fbo->clear(c);
+
+		return 0;
+	}
+
 	static const luaL_Reg functions[] = {
 		{ "renderTo", w_Framebuffer_renderTo },
 		{ "getImageData", w_Framebuffer_getImageData },
 		{ "getFilter", w_Framebuffer_getFilter },
 		{ "setWrap", w_Framebuffer_setWrap },
 		{ "getWrap", w_Framebuffer_getWrap },
+		{ "clear", w_Framebuffer_clear },
 		{ 0, 0 }
 	};
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.