Add getWidth and getHeight to Canvas (issue #307)

This commit is contained in:
Bart van Strien
2011-10-03 09:40:41 +02:00
parent 2949d2ea4a
commit 73de544d21
2 changed files with 18 additions and 0 deletions
@@ -140,6 +140,20 @@ namespace opengl
return 0;
}
int w_Canvas_getWidth(lua_State * L)
{
Canvas * canvas = luax_checkcanvas(L, 1);
lua_pushnumber(L, canvas->getWidth());
return 1;
}
int w_Canvas_getHeight(lua_State * L)
{
Canvas * canvas = luax_checkcanvas(L, 1);
lua_pushnumber(L, canvas->getHeight());
return 1;
}
static const luaL_Reg functions[] = {
{ "renderTo", w_Canvas_renderTo },
{ "getImageData", w_Canvas_getImageData },
@@ -148,6 +162,8 @@ namespace opengl
{ "setWrap", w_Canvas_setWrap },
{ "getWrap", w_Canvas_getWrap },
{ "clear", w_Canvas_clear },
{ "getWidth", w_Canvas_getWidth },
{ "getHeight", w_Canvas_getHeight },
{ 0, 0 }
};
@@ -20,6 +20,8 @@ namespace opengl
int w_Canvas_setWrap(lua_State * L);
int w_Canvas_getWrap(lua_State * L);
int w_Canvas_clear(lua_State * L);
int w_Canvas_getWidth(lua_State * L);
int w_Canvas_getHeight(lua_State * L);
int luaopen_canvas(lua_State * L);
} // opengl