diff options
Diffstat (limited to 'src/lua/modules/graphics/font.cpp')
-rw-r--r-- | src/lua/modules/graphics/font.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/lua/modules/graphics/font.cpp b/src/lua/modules/graphics/font.cpp index 15aa04e..0b0e1a0 100644 --- a/src/lua/modules/graphics/font.cpp +++ b/src/lua/modules/graphics/font.cpp @@ -37,11 +37,27 @@ namespace lua { Proxy* pFont = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_FONT); Font* font = pFont->getObject<Font>(); - Proxy* p = (Proxy*)luax_checktype(L, 2, JIN_GRAPHICS_PAGE); - Page* page = p->getObject<Page>(); - int x = luax_checkinteger(L, 3); - int y = luax_checkinteger(L, 4); - font->print(page, x, y); + if (luax_istype(L, 2, JIN_GRAPHICS_PAGE)) + { + Proxy* p = (Proxy*)luax_checktype(L, 2, JIN_GRAPHICS_PAGE); + Page* page = p->getObject<Page>(); + int x = luax_checkinteger(L, 3); + int y = luax_checkinteger(L, 4); + font->print(page, x, y); + } + else if (luax_isstring(L, 2)) + { + const char* text = luax_checkstring(L, 2); + int x = luax_checkinteger(L, 3); + int y = luax_checkinteger(L, 4); + int lh = luax_checkinteger(L, 5); + int sp = luax_checkinteger(L, 6); + font->print(text, x, y, lh, sp); + } + else + { + luax_typerror(L, 2, "font or string"); + } return 0; } |