Exposed the internal Rasterizer and GlyphData object methods to Lua. Also added Font:hasGlyph.

This commit is contained in:
Alex Szpakowski
2013-06-16 07:36:18 -03:00
parent dd9cca1a55
commit d48d1fd441
21 changed files with 449 additions and 24 deletions
+22
View File
@@ -152,6 +152,27 @@ int w_Font_getBaseline(lua_State *L)
return 1;
}
int w_Font_hasGlyph(lua_State *L)
{
Font *t = luax_checkfont(L, 1);
bool hasglyph = false;
try
{
if (lua_type(L, 2) == LUA_TSTRING)
hasglyph = t->hasGlyph(luax_checkstring(L, 2));
else
hasglyph = t->hasGlyph((unsigned int) luaL_checknumber(L, 2));
}
catch (love::Exception &e)
{
return luaL_error(L, "%s", e.what());
}
luax_pushboolean(L, hasglyph);
return 1;
}
static const luaL_Reg functions[] =
{
{ "getHeight", w_Font_getHeight },
@@ -164,6 +185,7 @@ static const luaL_Reg functions[] =
{ "getAscent", w_Font_getAscent },
{ "getDescent", w_Font_getDescent },
{ "getBaseline", w_Font_getBaseline },
{ "hasGlyph", w_Font_hasGlyph },
{ 0, 0 }
};