aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/graphics/canvas.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-10-23 12:23:58 +0800
committerchai <chaifix@163.com>2018-10-23 12:23:58 +0800
commit40fc27154fe754181934dc7ee31375e6bdfb33fc (patch)
tree897ad98d759bc308ef66561181ba88b85f2ccd47 /src/lua/modules/graphics/canvas.cpp
parent1480c9445100075c9e1a894eb07c0ef727b509a1 (diff)
*merge from minimal
Diffstat (limited to 'src/lua/modules/graphics/canvas.cpp')
-rw-r--r--src/lua/modules/graphics/canvas.cpp108
1 files changed, 49 insertions, 59 deletions
diff --git a/src/lua/modules/graphics/canvas.cpp b/src/lua/modules/graphics/canvas.cpp
index f42dfba..e49e209 100644
--- a/src/lua/modules/graphics/canvas.cpp
+++ b/src/lua/modules/graphics/canvas.cpp
@@ -3,73 +3,63 @@
#include "lua/common/common.h"
#include "libjin/jin.h"
-namespace jin
-{
-namespace lua
+namespace JinEngine
{
+ namespace Lua
+ {
- using namespace jin::graphics;
+ using namespace JinEngine::Graphics;
- typedef Ref<Canvas>& CanvasRef;
+ typedef Ref<Canvas>& CanvasRef;
- static inline CanvasRef checkCanvas(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- return proxy->getRef<Canvas>();
- }
-
- static int l_getWidth(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getWidth());
- return 1;
- }
+ static inline CanvasRef checkCanvas(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
+ return proxy->getRef<Canvas>();
+ }
- static int l_getHeight(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getHeight());
- return 1;
- }
+ static int l_getWidth(lua_State* L)
+ {
+ CanvasRef ref = checkCanvas(L);
+ luax_pushnumber(L, ref->getWidth());
+ return 1;
+ }
- static int l_getSize(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- luax_pushnumber(L, ref->getWidth());
- luax_pushnumber(L, ref->getHeight());
- return 2;
- }
+ static int l_getHeight(lua_State* L)
+ {
+ CanvasRef ref = checkCanvas(L);
+ luax_pushnumber(L, ref->getHeight());
+ return 1;
+ }
- static int l_setAnchor(lua_State* L)
- {
- CanvasRef ref = checkCanvas(L);
- int x = luax_checknumber(L, 1);
- int y = luax_checknumber(L, 2);
- ref->setAnchor(x, y);
- return 0;
- }
+ static int l_getSize(lua_State* L)
+ {
+ CanvasRef ref = checkCanvas(L);
+ luax_pushnumber(L, ref->getWidth());
+ luax_pushnumber(L, ref->getHeight());
+ return 2;
+ }
- static int l_gc(lua_State* L)
- {
- Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
- proxy->release();
- return 0;
- }
+ static int l_gc(lua_State* L)
+ {
+ Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_CANVAS);
+ proxy->release();
+ return 0;
+ }
- static const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "getWidth", l_getWidth },
- { "getHeight", l_getHeight },
- { "getSize", l_getSize },
- { "setAnchor", l_setAnchor },
- { 0, 0 }
- };
+ static const luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "getWidth", l_getWidth },
+ { "getHeight", l_getHeight },
+ { "getSize", l_getSize },
+ { 0, 0 }
+ };
- int luaopen_Canvas(lua_State* L)
- {
- luax_newtype(L, JIN_GRAPHICS_CANVAS, f);
- return 0;
- }
+ int luaopen_Canvas(lua_State* L)
+ {
+ luax_newtype(L, JIN_GRAPHICS_CANVAS, f);
+ return 0;
+ }
-}// lua
-}// jin \ No newline at end of file
+ } // namespace Lua
+} // namespace JinEngine \ No newline at end of file