From 3154c69a341028e88007b9883f438f75e0a5ff55 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 15 Oct 2018 12:55:29 +0800 Subject: =?UTF-8?q?*=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/graphics.cpp | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/lua/modules/graphics/graphics.cpp') 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) -- cgit v1.1-26-g67d0