diff options
author | chai <chaifix@163.com> | 2018-12-24 08:15:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-24 08:15:13 +0800 |
commit | 6e64f600b662bbf5dd6cb63661504b67b60cddcd (patch) | |
tree | 23d4a4f7e5e837715af63d9077e51373b0abc188 /src/libjin-lua/modules/graphics/je_lua_graphics.cpp | |
parent | 145e0752c702fa354fb78d3f30fa4b8ec44bfe7b (diff) |
*stats
Diffstat (limited to 'src/libjin-lua/modules/graphics/je_lua_graphics.cpp')
-rw-r--r-- | src/libjin-lua/modules/graphics/je_lua_graphics.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libjin-lua/modules/graphics/je_lua_graphics.cpp b/src/libjin-lua/modules/graphics/je_lua_graphics.cpp index aeb1921..fe3b3d8 100644 --- a/src/libjin-lua/modules/graphics/je_lua_graphics.cpp +++ b/src/libjin-lua/modules/graphics/je_lua_graphics.cpp @@ -306,7 +306,7 @@ namespace JinEngine LUA_IMPLEMENT int l_present(lua_State* L) { - Window::get()->swapBuffers(); + Window::get()->present(); return 0; } @@ -992,6 +992,20 @@ namespace JinEngine return 0; } + LUA_IMPLEMENT int l_getStats(lua_State* L) + { + OpenGL::Stats stats = gl.getStats(); + luax_newtable(L); + luax_setfieldinteger(L, "drawCalls", stats.drawCalls); + luax_setfieldinteger(L, "canvasSwitches", stats.canvasSwitches); + luax_setfieldinteger(L, "shaderSwitches", stats.shaderSwitches); + luax_setfieldinteger(L, "fontSwitches", stats.fontSwitches); + luax_setfieldinteger(L, "textures", stats.textures); + luax_setfieldinteger(L, "canvases", stats.canvases); + luax_setfieldinteger(L, "fonts", stats.fonts); + return 1; + } + LUA_EXPORT int luaopen_graphics(lua_State* L) { luaopen_Bitmap(L); @@ -1011,6 +1025,7 @@ namespace JinEngine luaopen_Mesh(L); luaL_Reg methods[] = { + { "getStats", l_getStats }, /* window */ { "init", l_init }, { "setTitle", l_setTitle }, |