mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 01:11:12 +02:00
CLuaInstance: Add function getRenderWidth()
This commit is contained in:
@@ -340,6 +340,7 @@ const luaL_Reg CLuaInstance::methods[] =
|
|||||||
{ "PaintIcon", CLuaInstance::PaintIcon },
|
{ "PaintIcon", CLuaInstance::PaintIcon },
|
||||||
{ "GetInput", CLuaInstance::GetInput },
|
{ "GetInput", CLuaInstance::GetInput },
|
||||||
{ "FontHeight", CLuaInstance::FontHeight },
|
{ "FontHeight", CLuaInstance::FontHeight },
|
||||||
|
{ "getRenderWidth", CLuaInstance::getRenderWidth },
|
||||||
{ "GetSize", CLuaInstance::GetSize },
|
{ "GetSize", CLuaInstance::GetSize },
|
||||||
{ "DisplayImage", CLuaInstance::DisplayImage },
|
{ "DisplayImage", CLuaInstance::DisplayImage },
|
||||||
{ "Blit", CLuaInstance::Blit },
|
{ "Blit", CLuaInstance::Blit },
|
||||||
@@ -555,6 +556,24 @@ int CLuaInstance::RenderString(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CLuaInstance::getRenderWidth(lua_State *L)
|
||||||
|
{
|
||||||
|
int f;
|
||||||
|
const char *text;
|
||||||
|
DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
|
||||||
|
|
||||||
|
CLuaData *W = CheckData(L, 1);
|
||||||
|
if (!W)
|
||||||
|
return 0;
|
||||||
|
f = luaL_checkint(L, 2); /* font number, use FONT['xxx'] for FONT_TYPE_xxx in the script */
|
||||||
|
text = luaL_checkstring(L, 3); /* text */
|
||||||
|
if (f >= SNeutrinoSettings::FONT_TYPE_COUNT || f < 0)
|
||||||
|
f = SNeutrinoSettings::FONT_TYPE_MENU;
|
||||||
|
|
||||||
|
lua_pushinteger(L, (int)g_Font[f]->getRenderWidth(text, true));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int CLuaInstance::GetInput(lua_State *L)
|
int CLuaInstance::GetInput(lua_State *L)
|
||||||
{
|
{
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
|
@@ -155,6 +155,7 @@ private:
|
|||||||
static int PaintBox(lua_State *L);
|
static int PaintBox(lua_State *L);
|
||||||
static int PaintIcon(lua_State *L);
|
static int PaintIcon(lua_State *L);
|
||||||
static int RenderString(lua_State *L);
|
static int RenderString(lua_State *L);
|
||||||
|
static int getRenderWidth(lua_State *L);
|
||||||
static int FontHeight(lua_State *L);
|
static int FontHeight(lua_State *L);
|
||||||
static int GetInput(lua_State *L);
|
static int GetInput(lua_State *L);
|
||||||
static int GCWindow(lua_State *L);
|
static int GCWindow(lua_State *L);
|
||||||
|
Reference in New Issue
Block a user