diff options
-rw-r--r-- | src/libjin/Graphics/Font/TTF.cpp | 8 | ||||
-rw-r--r-- | src/lua/modules/graphics/graphics.cpp | 35 |
2 files changed, 22 insertions, 21 deletions
diff --git a/src/libjin/Graphics/Font/TTF.cpp b/src/libjin/Graphics/Font/TTF.cpp index ff4dcc7..0e70d70 100644 --- a/src/libjin/Graphics/Font/TTF.cpp +++ b/src/libjin/Graphics/Font/TTF.cpp @@ -18,9 +18,9 @@ namespace jin namespace graphics { - /////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// // TTFData - /////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// TTFData* TTFData::createTTFData(const unsigned char* data, unsigned int size) { @@ -138,9 +138,9 @@ namespace graphics return bitmap32; } - /////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// // TTF - /////////////////////////////////////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////////////////// #include "../Shaders/font.shader.h" diff --git a/src/lua/modules/graphics/graphics.cpp b/src/lua/modules/graphics/graphics.cpp index 5d99915..620c239 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -264,23 +264,6 @@ namespace lua font->print(*text, x, y, lineheight, spacing); } - /* print(string, x, y, lineheight, spacing) */ - static int l_print(lua_State* L) - { - Font* font = context.curFont; - if (font == nullptr) - return 0; - unsigned length; - const char* str = luax_checklstring(L, 1, &length); - Text text(Encode::UTF8, str, length); - int x = luax_optnumber(L, 2, 0); - int y = luax_optnumber(L, 3, 0); - int lineheight = luax_optnumber(L, 4, font->getFontSize()); - int spacing = luax_optnumber(L, 5, 0); - font->print(text, x, y, lineheight, spacing); - return 0; - } - /* jin.graphics.draw(page, x, y) */ static void l_draw_page(lua_State* L) { @@ -354,6 +337,24 @@ namespace lua } } + /* print(string, x, y, lineheight, spacing) */ + /* need set font */ + static int l_print(lua_State* L) + { + Font* font = context.curFont; + if (font == nullptr) + return 0; + unsigned length; + const char* str = luax_checklstring(L, 1, &length); + Text text(Encode::UTF8, str, length); + int x = luax_optnumber(L, 2, 0); + int y = luax_optnumber(L, 3, 0); + int lineheight = luax_optnumber(L, 4, font->getFontSize()); + int spacing = luax_optnumber(L, 5, 0); + font->print(text, x, y, lineheight, spacing); + return 0; + } + static int l_setColor(lua_State* L) { if (luax_gettop(L) == 0) |