mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Add getWidth and getHeight to Canvas (issue #307)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user