mirror of
https://github.com/love2d/love.git
synced 2026-08-13 00:50:51 +02:00
Added love.graphics.getDimensions and Image/Canvas/ImageData:getDimensions (issue #566)
This commit is contained in:
@@ -209,6 +209,14 @@ int w_Canvas_getHeight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Canvas_getDimensions(lua_State *L)
|
||||
{
|
||||
Canvas *canvas = luax_checkcanvas(L, 1);
|
||||
lua_pushnumber(L, canvas->getWidth());
|
||||
lua_pushnumber(L, canvas->getHeight());
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_Canvas_getType(lua_State *L)
|
||||
{
|
||||
Canvas *canvas = luax_checkcanvas(L, 1);
|
||||
@@ -231,6 +239,7 @@ static const luaL_Reg functions[] =
|
||||
{ "clear", w_Canvas_clear },
|
||||
{ "getWidth", w_Canvas_getWidth },
|
||||
{ "getHeight", w_Canvas_getHeight },
|
||||
{ "getDimensions", w_Canvas_getDimensions },
|
||||
{ "getType", w_Canvas_getType },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@ 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 w_Canvas_getDimensions(lua_State *L);
|
||||
int w_Canvas_getType(lua_State *L);
|
||||
extern "C" int luaopen_canvas(lua_State *L);
|
||||
|
||||
|
||||
@@ -186,6 +186,13 @@ int w_getHeight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getDimensions(lua_State *L)
|
||||
{
|
||||
lua_pushnumber(L, instance->getWidth());
|
||||
lua_pushnumber(L, instance->getHeight());
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_isCreated(lua_State *L)
|
||||
{
|
||||
luax_pushboolean(L, instance->isCreated());
|
||||
@@ -1340,6 +1347,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
{ "getWidth", w_getWidth },
|
||||
{ "getHeight", w_getHeight },
|
||||
{ "getDimensions", w_getDimensions },
|
||||
|
||||
{ "isCreated", w_isCreated },
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ int w_setCaption(lua_State *L);
|
||||
int w_getCaption(lua_State *L);
|
||||
int w_getWidth(lua_State *L);
|
||||
int w_getHeight(lua_State *L);
|
||||
int w_getDimensions(lua_State *L);
|
||||
int w_isCreated(lua_State *L);
|
||||
int w_setScissor(lua_State *L);
|
||||
int w_getScissor(lua_State *L);
|
||||
|
||||
@@ -47,6 +47,14 @@ int w_Image_getHeight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Image_getDimensions(lua_State *L)
|
||||
{
|
||||
Image *t = luax_checkimage(L, 1);
|
||||
lua_pushnumber(L, t->getWidth());
|
||||
lua_pushnumber(L, t->getHeight());
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_Image_setFilter(lua_State *L)
|
||||
{
|
||||
Image *t = luax_checkimage(L, 1);
|
||||
@@ -178,6 +186,7 @@ static const luaL_Reg functions[] =
|
||||
{
|
||||
{ "getWidth", w_Image_getWidth },
|
||||
{ "getHeight", w_Image_getHeight },
|
||||
{ "getDimensions", w_Image_getDimensions },
|
||||
{ "setFilter", w_Image_setFilter },
|
||||
{ "getFilter", w_Image_getFilter },
|
||||
{ "setWrap", w_Image_setWrap },
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace opengl
|
||||
Image *luax_checkimage(lua_State *L, int idx);
|
||||
int w_Image_getWidth(lua_State *L);
|
||||
int w_Image_getHeight(lua_State *L);
|
||||
int w_Image_getDimensions(lua_State *L);
|
||||
int w_Image_setFilter(lua_State *L);
|
||||
int w_image_getFilter(lua_State *L);
|
||||
int w_Image_setMipmapFilter(lua_State *L);
|
||||
|
||||
@@ -47,6 +47,14 @@ int w_ImageData_getHeight(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_ImageData_getDimensions(lua_State *L)
|
||||
{
|
||||
ImageData *t = luax_checkimagedata(L, 1);
|
||||
lua_pushinteger(L, t->getWidth());
|
||||
lua_pushinteger(L, t->getHeight());
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_ImageData_getPixel(lua_State *L)
|
||||
{
|
||||
ImageData *t = luax_checkimagedata(L, 1);
|
||||
@@ -188,6 +196,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
{ "getWidth", w_ImageData_getWidth },
|
||||
{ "getHeight", w_ImageData_getHeight },
|
||||
{ "getDimensions", w_ImageData_getDimensions },
|
||||
{ "getPixel", w_ImageData_getPixel },
|
||||
{ "setPixel", w_ImageData_setPixel },
|
||||
{ "mapPixel", w_ImageData_mapPixel },
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace image
|
||||
ImageData *luax_checkimagedata(lua_State *L, int idx);
|
||||
int w_ImageData_getWidth(lua_State *L);
|
||||
int w_ImageData_getHeight(lua_State *L);
|
||||
int w_ImageData_getDimensions(lua_State *L);
|
||||
int w_ImageData_getPixel(lua_State *L);
|
||||
int w_ImageData_setPixel(lua_State *L);
|
||||
int w_ImageData_mapPixel(lua_State *L);
|
||||
|
||||
Reference in New Issue
Block a user