From 7299a237fb4b7cef7a466396ad402ae5c34249ba Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 16 Jan 2016 12:51:31 -0400 Subject: [PATCH] Added Text:getDimensions --- src/modules/graphics/opengl/wrap_Text.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/modules/graphics/opengl/wrap_Text.cpp b/src/modules/graphics/opengl/wrap_Text.cpp index 46eb2ab1e..3981209a0 100644 --- a/src/modules/graphics/opengl/wrap_Text.cpp +++ b/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 } };