Selaa lähdekoodia

Added Text:getDimensions

Alex Szpakowski 10 vuotta sitten
vanhempi
sitoutus
7299a237fb
1 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 10 0
      src/modules/graphics/opengl/wrap_Text.cpp

+ 10 - 0
src/modules/graphics/opengl/wrap_Text.cpp

@@ -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 }
 };