Skip to content

Commit e27f38a

Browse files
authored
improve comments in example (#8127)
# Objective Added additional comments to describe what is going on in an example.
1 parent 7b7294b commit e27f38a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

examples/2d/texture_atlas.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ struct RpgSpriteHandles {
3535
}
3636

3737
fn load_textures(mut rpg_sprite_handles: ResMut<RpgSpriteHandles>, asset_server: Res<AssetServer>) {
38+
// load multiple, individual sprites from a folder
3839
rpg_sprite_handles.handles = asset_server.load_folder("textures/rpg").unwrap();
3940
}
4041

@@ -43,6 +44,7 @@ fn check_textures(
4344
rpg_sprite_handles: ResMut<RpgSpriteHandles>,
4445
asset_server: Res<AssetServer>,
4546
) {
47+
// Advance the `AppState` once all sprite handles have been loaded by the `AssetServer`
4648
if let LoadState::Loaded = asset_server
4749
.get_group_load_state(rpg_sprite_handles.handles.iter().map(|handle| handle.id()))
4850
{
@@ -57,6 +59,7 @@ fn setup(
5759
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
5860
mut textures: ResMut<Assets<Image>>,
5961
) {
62+
// Build a `TextureAtlas` using the individual sprites
6063
let mut texture_atlas_builder = TextureAtlasBuilder::default();
6164
for handle in &rpg_sprite_handles.handles {
6265
let handle = handle.typed_weak();

0 commit comments

Comments
 (0)