mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG-- branch : minor
This commit is contained in:
@@ -30,7 +30,7 @@ namespace opengl
|
||||
|
||||
Canvas *luax_checkcanvas(lua_State *L, int idx)
|
||||
{
|
||||
return luax_checktype<Canvas>(L, idx, "Canvas", GRAPHICS_CANVAS_T);
|
||||
return luax_checktype<Canvas>(L, idx, GRAPHICS_CANVAS_ID);
|
||||
}
|
||||
|
||||
int w_Canvas_renderTo(lua_State *L)
|
||||
@@ -65,7 +65,7 @@ int w_Canvas_renderTo(lua_State *L)
|
||||
int w_Canvas_newImageData(lua_State *L)
|
||||
{
|
||||
Canvas *canvas = luax_checkcanvas(L, 1);
|
||||
love::image::Image *image = luax_getmodule<love::image::Image>(L, "image", MODULE_IMAGE_T);
|
||||
love::image::Image *image = luax_getmodule<love::image::Image>(L, MODULE_IMAGE_ID);
|
||||
int x = luaL_optint(L, 2, 0);
|
||||
int y = luaL_optint(L, 3, 0);
|
||||
int w = luaL_optint(L, 4, canvas->getWidth());
|
||||
@@ -74,7 +74,7 @@ int w_Canvas_newImageData(lua_State *L)
|
||||
love::image::ImageData *img = nullptr;
|
||||
luax_catchexcept(L, [&](){ img = canvas->newImageData(image, x, y, w, h); });
|
||||
|
||||
luax_pushtype(L, "ImageData", IMAGE_IMAGE_DATA_T, img);
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, img);
|
||||
img->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -118,7 +118,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
extern "C" int luaopen_canvas(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "Canvas", functions);
|
||||
return luax_register_type(L, GRAPHICS_CANVAS_ID, functions);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
Reference in New Issue
Block a user