aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules')
-rw-r--r--src/lua/modules/graphics/je_lua_graphics.cpp48
-rw-r--r--src/lua/modules/time/je_lua_timer.cpp12
2 files changed, 57 insertions, 3 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 }
};
diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp
index 9104a42..540f205 100644
--- a/src/lua/modules/time/je_lua_timer.cpp
+++ b/src/lua/modules/time/je_lua_timer.cpp
@@ -47,7 +47,9 @@ namespace JinEngine
func->pushParam(i);
Timer::Handler* handler = timer->every(s, timerCallback, func, finishCallback);
Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
- proxy->bind(new Shared<Timer::Handler>(handler, Jin_Lua_Handler));
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
return 1;
}
@@ -64,7 +66,9 @@ namespace JinEngine
func->pushParam(i);
Timer::Handler* handler = timer->after(s, timerCallback, func, finishCallback);
Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
- proxy->bind(new Shared<Timer::Handler>(handler, Jin_Lua_Handler));
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
return 1;
}
@@ -82,7 +86,9 @@ namespace JinEngine
func->pushParam(i);
Timer::Handler* handler = timer->repeat(s, count, timerCallback, func, finishCallback);
Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler);
- proxy->bind(new Shared<Timer::Handler>(handler, Jin_Lua_Handler));
+ Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler);
+ shrHandler->retain();
+ proxy->bind(shrHandler);
return 1;
}