From e72188433348c270a54879da9f086f1b527b580f Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 7 Sep 2018 13:30:44 +0800 Subject: *update --- src/lua/modules/graphics/graphics.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/lua/modules/graphics/graphics.cpp') diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp index 573392d..8a58ff0 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -86,6 +86,21 @@ namespace lua int h = luax_checkinteger(L, 2); bitmap = Bitmap::createBitmap(w, h); } + else if (luax_gettop(L) == 3) + { + int w = luax_checkinteger(L, 1); + int h = luax_checkinteger(L, 2); + if (!luax_istable(L, 3)) + { + luax_typerror(L, 3, "table"); + return 1; + } + unsigned int r = luax_rawgetnumber(L, 3, 1); + unsigned int g = luax_rawgetnumber(L, 3, 2); + unsigned int b = luax_rawgetnumber(L, 3, 3); + unsigned int a = luax_rawgetnumber(L, 3, 4); + bitmap = Bitmap::createBitmap(w, h, Color(r, g, b, a)); + } else { const char* f = luax_checkstring(L, 1); -- cgit v1.1-26-g67d0