Bevy Heterogenous Texture Atlas Loader

crates.io MIT/Apache 2.0 crates.io

Bevy Heterogenous Texture Atlas Loader allows you to load heterogenous texture atlases from a RON file manifest.

Bevy Compatibility

| version | bevy | | ------- | ---- | | 0.7+ | 0.8 | | 0.6 | 0.7 | | < 0.6 | 0.6 |

#

Basic usage

  1. Add to your project's Cargo.toml [dependencies] section

    toml bevy_heterogeneous_texture_atlas_loader = "0.9.4"

  2. Add the TextureAtlasLoaderPlugin to your Bevy App. rust use bevy_heterogeneous_texture_atlas_loader::*; app.add_plugin(TextureAtlasLoaderPlugin);

  3. Add the atlas source image and .ron manifest to your assets folder.

  4. Load the texture atlas manifest using the asset server: rust let texture_atlas: Handle<TextureAtlas> = asset_server.load("<path>.ron"); The plugin will then load the atlas image and create the TextureAtlas asset automatically.

  5. The TextureAtlas's sprite indices respect the order of the sprites in the manifest. Atlas index 0 will be the first sprite in the manifest, 1 the second, and so on. You can also use the TextureAtlas::get_texture_index method to look up the index using an asset path: rust texture_atlas.get_texture_index(&Handle::weak("sprite_name".into()))

    which you can see used in \examples\example.rs

#

The Manifest

  1. Create a .ron file in your assets folder.

    The sprite indices in the output TextureAtlas are ordered implicitly according to the order of the input list sprite rects.

Examples