RAUI-labs/raui

[Feature] Auto-loading Fonts and Images in the Tetra

zicklag opened this issue · 3 comments

Something that is a little annoying about the current Tetra host is that you have to manually list all of the resources that you want to load. Is there a reason not to have the tetra host automatically load the resources just from file paths instead of making you specify them upfront?

That is how I have the Bevy Retro integration setup and it seems to work nicely so far. In order to avoid stalling the main UI thread we should probably load the resources in another thread, but that would be easy.

This is another thing that would make the getting started guide lower friction so I'm going to start trying to implement this now. Let me know if there are reasons not to do this.

Looks like Tetra's Font type is !Sync which prohibits loading fonts on a different thread. 🤔 Do you think it's enough to assume that loading images and fonts on-demand on the same thread is probably not going to be too big a deal for now?

Edit: Oh, I know, we can let you pre-load the textures and fonts the same way you do now, and if you try to use an image or font that isn't pre-loaded it will load it when it attempts to render the item. So you don't have to specify a list of fonts and images at host creation, but it will let you if you are worried about the latency of loading on-demand.

OK, finished the implementation of this. Will be opening a PR soon.

Fixed in #39.