Move wrapping to Font::getWrap and make printf use that (fixes issue #230)

This commit is contained in:
Bart van Strien
2011-09-03 14:31:31 +02:00
parent f9084c4625
commit 190e11d016
4 changed files with 52 additions and 74 deletions
+4 -3
View File
@@ -52,9 +52,10 @@ namespace opengl
Font * t = luax_checkfont(L, 1);
const char * str = luaL_checkstring(L, 2);
float wrap = (float) luaL_checknumber(L, 3);
int lines = 0;
lua_pushinteger(L, t->getWrap(str, wrap, &lines));
lua_pushinteger(L, lines);
int max_width = 0;
std::vector<std::string> lines = t->getWrap(str, wrap, &max_width);
lua_pushinteger(L, max_width);
lua_pushinteger(L, lines.size());
return 2;
}