From 252e074c41a73312be3e235b07be266a9aee59fb Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 15 Oct 2018 12:58:40 +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 | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 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 620c239..645ae4a 100644 --- a/src/lua/modules/graphics/graphics.cpp +++ b/src/lua/modules/graphics/graphics.cpp @@ -277,6 +277,24 @@ namespace lua font->print(page, x, y); } + /* 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_draw(lua_State* L) { if (luax_istype(L, 1, JIN_GRAPHICS_TEXTURE)) @@ -337,24 +355,6 @@ 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