Loading jarfile Textures solved
Dear @electronstudio , as I said I wrote a wrapper that allows to load Textures and Images from within the jarfile.
Without shipping the resources elsewhere. Without extracting them somewhere to a temporary location. Without using libGDX.
All I done (but it took me two days of research) was figuring out how RL loads images, and replacing all C-specific code with Java-specific code so that it does work.
Library: https://codeberg.org/glowiak/librlimg
I am not proposing a pull request, as you would probably f*ck it away as being bad code. Maybe it is bad code, but it works.
Well done.
I forgot Raylib had LoadImageFromMemory function, which is what you’ve used. So yeah you could extract to memory rather than a temp file.
@electronstudio Would be nice to to add some info about this to the readme, so that newcomers know how to workaround that.
@electronstudio Also, are there any plans to update Jaylib to 4.5?
I released 4.5.
The best place to put the jar image loader would probably be https://github.com/electronstudio/jaylib-example-project/tree/master/src/main/java/examples
@electronstudio The image loader in examples? Seems weird.
In my game it is just in a jarfile in the lib directory alongside with jaylib.
I’m reluctant to put any code into Jaylib that isn’t auto generated from Raylib. There is a small amount in Jaylib.java but if I put it there I’d have to check the quality of the code and maybe rewrite it.
Then just better to leave it as is, maybe optionally including a link in the readme.
@electronstudio I am working on also loading music streams from jars (as I plan to implement some sort of SFX in my game soon).
The MusicLoader class works, but only outside of jar. Weirdly, when running from jar the JVM itself crashes.
I will be working on that.