janet-lang / jaylib

Janet bindings to Raylib
MIT License
146 stars 37 forks source link

Is there a Janet equivalent for LoadImageFromMemory ? #63

Open gamecubate opened 6 months ago

gamecubate commented 6 months ago

Raylib's LoadImageFromMemory seems absent from Jaylib functions. Too complex to port or in the works? If neither, I'll take a look at it.

kamisori commented 6 months ago
static Janet cfun_LoadImageFromBuffer(int32_t argc, Janet *argv) {
    janet_fixarity(argc, 2);
    const char *fileType = janet_getcstring(argv, 0);
    JanetBuffer* data = janet_getbuffer(argv, 1);
    Image *image = janet_abstract(&AT_Image, sizeof(Image));
    *image = LoadImageFromMemory(fileType, data->data, data->count);
    return janet_wrap_abstract(image);
}

https://github.com/janet-lang/jaylib/commit/c48b965021daa816f1cd1c5a372cfcd4ed6ce4e4