hephae_atlas/
lib.rs

1#![allow(internal_features)]
2#![cfg_attr(any(docsrs, docsrs_dep), feature(rustdoc_internals))]
3#![doc = include_str!("../README.md")]
4#![cfg_attr(doc, deny(missing_docs))]
5
6use bevy_app::prelude::*;
7use bevy_asset::prelude::*;
8use hephae_utils::prelude::*;
9
10use crate::{
11    asset::TextureAtlasLoader,
12    atlas::{AtlasEntry, AtlasPage, TextureAtlas, update_atlas_index},
13};
14
15pub mod asset;
16pub mod atlas;
17
18/// Common imports for [`hephae_atlas`](crate).
19pub mod prelude {
20    pub use crate::atlas::{AtlasEntry, AtlasIndex, AtlasPage, TextureAtlas};
21}
22
23plugin_def! {
24    /// Provides texture atlas functionality into the app.
25    pub struct AtlasPlugin;
26    fn build(&self, app: &mut App) {
27        app.init_asset::<TextureAtlas>()
28            .register_asset_reflect::<TextureAtlas>()
29            .register_asset_loader(TextureAtlasLoader)
30            .register_type::<AtlasPage>()
31            .register_type::<AtlasEntry>()
32            .add_systems(PostUpdate, update_atlas_index);
33    }
34}