Bevy Heterogenous Texture Atlas Loader allows you to load heterogenous texture atlases according to a RON file manifest.
This works (as far as I can tell), but the implementation could be improved a lot. Any suggestions would be very welcome.
Suports Bevy 0.6
#
We have a beautiful sprite sheet example.png
for our game:
But the sprites have irregular sizes and positions.
How to load it:
manifest.ron
manifest file in your assets folder
(
path: "example.png",
rects: [
("rothko", 16, 64, 19, 67),
("handsome face", 93, 125, 108, 139),
("cyan and peaches", 176, 196, 34, 68),
]
)
* You can call the manifest anything you like, not only manifest.ron
.
* The path
is relative to the root assets folder, not to the manifest file.
* The rects
coords are in order minx, maxx, miny, maxy.
* rects
is a list not a map to preserve ordering. The sprite indices in the text atlas are ordered implicitly according to the order of the rects list.
* If you don't need to look up the sprites by name, use an empty string:
rects: [
("", 16, 64, 19, 67),
...
Cargo.toml
bevy_heterogeneous_texture_atlas_loader = "0.1.2"
```rust use bevy::prelude::; use bevy_heterogeneous_texture_atlas_loader::;
fn setup(
mut commands: Commands,
assetserver: Res
fn onatlasloaded(
mut commands: Commands,
mut events: EventReader
fn main() { App::new() .addplugins(DefaultPlugins) .addplugin(HeterogeneousTextureAtlasLoaderPlugin) .addstartupsystem(setup) .addsystem(onatlas_loaded) .run(); } ``` 4. Result, lovely
#
I wish
"Manifest not found"?
You need to store a strong handle to the manifest in a resource or something, otherwise it will be dropped before the texture atlas is created.
Why are the names for everything so long?
Shorter than "Bevy Heterogenous Texture Atlas Ron Manifest Asynchronous Loader"