diff options
author | chai <chaifix@163.com> | 2018-10-15 12:55:29 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-15 12:55:29 +0800 |
commit | 3154c69a341028e88007b9883f438f75e0a5ff55 (patch) | |
tree | dd33a668026b39d87828a01216b65f7445048483 /src/lua/modules/graphics/graphics.cpp | |
parent | 68b60be0d1da84aa670d29b87b26ab3e3db51b69 (diff) |
*格式化代码
Diffstat (limited to 'src/lua/modules/graphics/graphics.cpp')
-rw-r--r-- | src/lua/modules/graphics/graphics.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
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) |