diff options
author | chai <chaifix@163.com> | 2018-08-20 08:15:34 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-20 08:15:34 +0800 |
commit | 98ab086f430d418f33c4410cf81f4eac52d5b835 (patch) | |
tree | 446cce66de209a10c9342bf98e21524de6e4ba05 /src/lua/graphics/luaopen_graphics.cpp | |
parent | 22bb9b537caff927ef8c83bde82d58253ffbb1e4 (diff) |
*update
Diffstat (limited to 'src/lua/graphics/luaopen_graphics.cpp')
-rw-r--r-- | src/lua/graphics/luaopen_graphics.cpp | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/src/lua/graphics/luaopen_graphics.cpp b/src/lua/graphics/luaopen_graphics.cpp index 42e8f3c..c189675 100644 --- a/src/lua/graphics/luaopen_graphics.cpp +++ b/src/lua/graphics/luaopen_graphics.cpp @@ -46,14 +46,28 @@ namespace lua return 0; } - static int l_getSize(lua_State* L) + static int l_getSize(lua_State* L) { Window* wnd = Window::get(); luax_pushnumber(L, wnd->getW()); - luax_pushnumber(L, wnd->getH()); - return 2; + luax_pushnumber(L, wnd->getH()); + return 2; } - + + static int l_getWidth(lua_State* L) + { + Window* wnd = Window::get(); + luax_pushnumber(L, wnd->getW()); + return 1; + } + + static int l_getHeight(lua_State* L) + { + Window* wnd = Window::get(); + luax_pushnumber(L, wnd->getH()); + return 1; + } + static int l_newImage(lua_State* L) { Filesystem* fs = Filesystem::get(); @@ -426,32 +440,34 @@ namespace lua } static const luaL_Reg f[] = { - { "init", l_init }, - { "size", l_getSize }, - { "Image", l_newImage }, - { "Shader", l_newShader }, - { "Canvas", l_newCanvas }, - { "Font", l_newFont }, - { "box", l_box }, - { "write", l_write }, - { "clear", l_clear }, - { "draw", l_draw }, - { "color", l_setColor }, - { "palette", l_getColor }, - { "present", l_present }, - { "study", l_study }, - { "bind", l_bindCanvas }, - { "unbind", l_unbindCanvas }, - { "use", l_useShader }, - { "unuse", l_unuseShader }, - { "point", l_drawpoint }, - { "line", l_drawLine }, - { "rect", l_drawRect }, - { "circle", l_drawCircle }, - { "triangle", l_drawTriangle }, - { "polygon", l_drawPolygon }, - { "destroy", l_destroy }, - { 0, 0 } + { "init", l_init }, + { "size", l_getSize }, + { "getWidth", l_getWidth }, + { "getHeight", l_getHeight }, + { "newImage", l_newImage }, + { "newShader", l_newShader }, + { "newCanvas", l_newCanvas }, + { "newFont", l_newFont }, + { "box", l_box }, + { "write", l_write }, + { "clear", l_clear }, + { "draw", l_draw }, + { "color", l_setColor }, + { "palette", l_getColor }, + { "present", l_present }, + { "study", l_study }, + { "bind", l_bindCanvas }, + { "unbind", l_unbindCanvas }, + { "use", l_useShader }, + { "unuse", l_unuseShader }, + { "point", l_drawpoint }, + { "line", l_drawLine }, + { "rect", l_drawRect }, + { "circle", l_drawCircle }, + { "triangle", l_drawTriangle }, + { "polygon", l_drawPolygon }, + { "destroy", l_destroy }, + { 0, 0 } }; extern int luaopen_Image(lua_State* L); |