From e654344bc262c8393559e5cd535f440133fb2406 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 15 Nov 2018 21:44:02 +0800 Subject: =?UTF-8?q?*=E6=B8=B2=E6=9F=93=E7=9F=A9=E9=98=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/je_lua_graphics.cpp | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/lua/modules/graphics/je_lua_graphics.cpp') diff --git a/src/lua/modules/graphics/je_lua_graphics.cpp b/src/lua/modules/graphics/je_lua_graphics.cpp index 0a5394d..ce569d0 100644 --- a/src/lua/modules/graphics/je_lua_graphics.cpp +++ b/src/lua/modules/graphics/je_lua_graphics.cpp @@ -802,6 +802,47 @@ namespace JinEngine return 0; } + LUA_IMPLEMENT int l_clearMatrix(lua_State* L) + { + gl.clearMatrix(); + return 0; + } + + LUA_IMPLEMENT int l_pushMatrix(lua_State* L) + { + gl.push(); + return 0; + } + + LUA_IMPLEMENT int l_popMatrix(lua_State* L) + { + gl.pop(); + return 0; + } + + LUA_IMPLEMENT int l_scale(lua_State* L) + { + float sx = luax_checknumber(L, 1); + float sy = luax_checknumber(L, 2); + gl.scale(sx, sy); + return 0; + } + + LUA_IMPLEMENT int l_translate(lua_State* L) + { + float x = luax_checknumber(L, 1); + float y = luax_checknumber(L, 2); + gl.translate(x, y); + return 0; + } + + LUA_IMPLEMENT int l_rotate(lua_State* L) + { + float r = luax_checknumber(L, 1); + gl.rotate(r); + return 0; + } + LUA_EXPORT int luaopen_graphics(lua_State* L) { luaopen_Bitmap(L); @@ -861,6 +902,13 @@ namespace JinEngine /* font */ { "setFont", l_setFont }, { "unsetFont", l_unsetFont }, + /* transform */ + { "pushMatrix", l_pushMatrix }, + { "clearMatrix", l_clearMatrix }, + { "popMatrix", l_popMatrix }, + { "translate", l_translate }, + { "rotate", l_rotate }, + { "scale", l_scale }, { 0, 0 } }; -- cgit v1.1-26-g67d0