Compile Love for ImageData getPointer shortcut
Posted: Sun May 11, 2014 2:44 am
Hi, I tried all day yesterday to compile Love so I could add this one function, but I have bad luck with other people's code. I just need to bypass having to store ImageData in Lua and go straight to the pointer, and I was wondering if someone who already knows how to compile Love could do it for me real quick. This code might be incorrect, I don't know how the Lua interface works, but something like this. I'm hoping it's not a big deal, and I would be thankful to have it
Code: Select all
int w_Canvas_getImageDataPointer(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::ImageData *img = canvas->getImageData(image);
//Data *t = luax_checkdata(L, 1);
lua_pushlightuserdata(L, img->getData());
return 1;
}