mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +02:00
luainstance: return render width from RenderString
Return the string's renderwidth from RenderString. If boxh is < 0 then the string is not rendered and only the width is determined.
This commit is contained in:
committed by
M. Liebmann
parent
7c7c7e55a4
commit
a61dbcee0b
@@ -458,14 +458,16 @@ int CLuaInstance::RenderString(lua_State *L)
|
|||||||
center = luaL_checkint(L, 9);
|
center = luaL_checkint(L, 9);
|
||||||
if (f >= SNeutrinoSettings::FONT_TYPE_COUNT || f < 0)
|
if (f >= SNeutrinoSettings::FONT_TYPE_COUNT || f < 0)
|
||||||
f = SNeutrinoSettings::FONT_TYPE_MENU;
|
f = SNeutrinoSettings::FONT_TYPE_MENU;
|
||||||
if (center) { /* center the text inside the box */
|
|
||||||
int rwidth = g_Font[f]->getRenderWidth(text, true);
|
int rwidth = g_Font[f]->getRenderWidth(text, true);
|
||||||
|
if (center) { /* center the text inside the box */
|
||||||
if (rwidth < w)
|
if (rwidth < w)
|
||||||
x += (w - rwidth) / 2;
|
x += (w - rwidth) / 2;
|
||||||
}
|
}
|
||||||
c &= 0x000000FF; /* TODO: colors that are not in the palette? */
|
c &= 0x000000FF; /* TODO: colors that are not in the palette? */
|
||||||
|
if (boxh > -1) /* if boxh < 0, don't paint string */
|
||||||
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh, true);
|
W->fbwin->RenderString(g_Font[f], x, y, w, text, c, boxh, true);
|
||||||
return 0;
|
lua_pushinteger(L, rwidth); /* return renderwidth */
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstance::GetInput(lua_State *L)
|
int CLuaInstance::GetInput(lua_State *L)
|
||||||
|
Reference in New Issue
Block a user