Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading jarfile Textures solved #39

Open
glowiak opened this issue Nov 2, 2023 · 8 comments
Open

Loading jarfile Textures solved #39

glowiak opened this issue Nov 2, 2023 · 8 comments

Comments

@glowiak
Copy link

glowiak commented Nov 2, 2023

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.

@electronstudio
Copy link
Owner

electronstudio commented Nov 2, 2023

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.

@glowiak
Copy link
Author

glowiak commented Nov 2, 2023

@electronstudio Would be nice to to add some info about this to the readme, so that newcomers know how to workaround that.

@glowiak
Copy link
Author

glowiak commented Nov 2, 2023

@electronstudio Also, are there any plans to update Jaylib to 4.5?

@electronstudio
Copy link
Owner

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

@glowiak
Copy link
Author

glowiak commented Nov 5, 2023

@electronstudio The image loader in examples? Seems weird.

In my game it is just in a jarfile in the lib directory alongside with jaylib.

@electronstudio
Copy link
Owner

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.

@glowiak
Copy link
Author

glowiak commented Nov 5, 2023

Then just better to leave it as is, maybe optionally including a link in the readme.

@glowiak
Copy link
Author

glowiak commented Nov 6, 2023

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants