Added Text:getDimensions

This commit is contained in:
Alex Szpakowski
2016-01-16 12:51:31 -04:00
parent 9ec6eceb8a
commit 7299a237fb
+10
View File
@@ -222,6 +222,15 @@ int w_Text_getHeight(lua_State *L)
return 1;
}
int w_Text_getDimensions(lua_State *L)
{
Text *t = luax_checktext(L, 1);
int index = (int) luaL_optnumber(L, 2, 0) - 1;
lua_pushnumber(L, t->getWidth(index));
lua_pushnumber(L, t->getHeight(index));
return 2;
}
static const luaL_Reg w_Text_functions[] =
{
{ "set", w_Text_set },
@@ -233,6 +242,7 @@ static const luaL_Reg w_Text_functions[] =
{ "getFont", w_Text_getFont },
{ "getWidth", w_Text_getWidth },
{ "getHeight", w_Text_getHeight },
{ "getDimensions", w_Text_getDimensions },
{ 0, 0 }
};