aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/graphics.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-09-07 13:30:44 +0800
committerchai <chaifix@163.com>2018-09-07 13:30:44 +0800
commite72188433348c270a54879da9f086f1b527b580f (patch)
treeb2cb92b37579c6f9cff77f52fc591426eb2d8286 /src/lua/modules/graphics/graphics.cpp
parent28ca1f570d417671904a25c2a9c589fdb1eb7a03 (diff)
*update
Diffstat (limited to 'src/lua/modules/graphics/graphics.cpp')
-rw-r--r--src/lua/modules/graphics/graphics.cpp15
1 files changed, 15 insertions, 0 deletions
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);