Browse Source

love.graphics.setColorMask() with no arguments enabled all color components

Alex Szpakowski 12 years ago
parent
commit
15535517d6
1 changed files with 11 additions and 2 deletions
  1. 11 2
      src/modules/graphics/opengl/wrap_Graphics.cpp

+ 11 - 2
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -632,8 +632,17 @@ int w_getFont(lua_State *L)
 int w_setColorMask(lua_State *L)
 int w_setColorMask(lua_State *L)
 {
 {
 	bool mask[4];
 	bool mask[4];
-	for (int i = 0; i < 4; i++)
-		mask[i] = luax_toboolean(L, i + 1);
+
+	if (lua_gettop(L) == 0)
+	{
+		// Enable all color components if no argument is given.
+		mask[0] = mask[1] = mask[2] = mask[3] = true;
+	}
+	else
+	{
+		for (int i = 0; i < 4; i++)
+			mask[i] = luax_toboolean(L, i + 1);
+	}
 
 
 	// r, g, b, a
 	// r, g, b, a
 	instance->setColorMask(mask[0], mask[1], mask[2], mask[3]);
 	instance->setColorMask(mask[0], mask[1], mask[2], mask[3]);