aboutsummaryrefslogtreecommitdiff
path: root/src/libjin-lua/modules/graphics/je_lua_graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin-lua/modules/graphics/je_lua_graphics.cpp')
-rw-r--r--src/libjin-lua/modules/graphics/je_lua_graphics.cpp17
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 },