aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/je_lua_graphics.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-15 21:44:02 +0800
committerchai <chaifix@163.com>2018-11-15 21:44:02 +0800
commite654344bc262c8393559e5cd535f440133fb2406 (patch)
tree7ac96581726c7d81599d72fdd811b5d991e2e362 /src/lua/modules/graphics/je_lua_graphics.cpp
parent7e51ff3bfae0becc260452a427a1fc1232a4b348 (diff)
*渲染矩阵
Diffstat (limited to 'src/lua/modules/graphics/je_lua_graphics.cpp')
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp48
1 files changed, 48 insertions, 0 deletions
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 }
};