lua: implement kill() for cctext items

ct:kill()
This commit is contained in:
2022-04-22 22:01:48 +02:00
parent e4939264f0
commit 32abde37de
2 changed files with 19 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ void CLuaInstCCText::CCTextRegister(lua_State *L)
{ "new", CLuaInstCCText::CCTextNew },
{ "paint", CLuaInstCCText::CCTextPaint },
{ "hide", CLuaInstCCText::CCTextHide },
{ "kill", CLuaInstCCText::CCTextKill },
{ "setText", CLuaInstCCText::CCTextSetText },
{ "getLines", CLuaInstCCText::CCTextGetLines },
{ "scroll", CLuaInstCCText::CCTextScroll },
@@ -201,6 +202,23 @@ int CLuaInstCCText::CCTextHide(lua_State *L)
return 0;
}
int CLuaInstCCText::CCTextKill(lua_State *L)
{
lua_assert(lua_istable(L,1));
CLuaCCText *D = CCTextCheck(L, 1);
if (!D) return 0;
lua_Unsigned color_bg = (lua_Unsigned)COL_BACKGROUND_PLUS_0;
lua_Integer corner_radius = -1;
if (lua_istable(L, -1)){
tableLookup(L, "color_bg", color_bg);
tableLookup(L, "corner_radius", corner_radius);
}
D->ct->kill(color_bg, corner_radius, ~CC_FBDATA_TYPES);
return 0;
}
int CLuaInstCCText::CCTextSetText(lua_State *L)
{
lua_assert(lua_istable(L,1));

View File

@@ -46,6 +46,7 @@ class CLuaInstCCText
static int CCTextNew(lua_State *L);
static int CCTextPaint(lua_State *L);
static int CCTextHide(lua_State *L);
static int CCTextKill(lua_State *L);
static int CCTextSetText(lua_State *L);
static int CCTextGetLines(lua_State *L);
static int CCTextScroll(lua_State *L);