diff --git a/crates/bevy_sprite/src/texture_atlas.rs b/crates/bevy_sprite/src/texture_atlas.rs index 2feed94da0f4f..db96733adb8b1 100644 --- a/crates/bevy_sprite/src/texture_atlas.rs +++ b/crates/bevy_sprite/src/texture_atlas.rs @@ -8,7 +8,7 @@ use bevy_utils::HashMap; /// Stores a map used to lookup the position of a texture in a [`TextureAtlas`]. /// This can be used to either use and look up a specific section of a texture, or animate frame-by-frame as a sprite sheet. /// -/// Optionaly it can store a mapping from sub texture handles to the related area index (see +/// Optionally it can store a mapping from sub texture handles to the related area index (see /// [`TextureAtlasBuilder`]). /// /// [Example usage animating sprite.](https://github.com/bevyengine/bevy/blob/latest/examples/2d/sprite_sheet.rs) @@ -35,7 +35,7 @@ pub struct TextureAtlasLayout { /// It stores a handle to [`TextureAtlasLayout`] and the index of the current section of the atlas. /// The texture atlas contains various *sections* of a given texture, allowing users to have a single /// image file for either sprite animation or global mapping. -/// You can change the texture [`index`](Self::index) of the atlas to animate the sprite or dsplay only a *section* of the texture +/// You can change the texture [`index`](Self::index) of the atlas to animate the sprite or display only a *section* of the texture /// for efficient rendering of related game objects. /// /// Check the following examples for usage: @@ -43,7 +43,7 @@ pub struct TextureAtlasLayout { /// - [`texture atlas example`](https://github.com/bevyengine/bevy/blob/latest/examples/2d/texture_atlas.rs) #[derive(Component, Default, Debug, Clone, Reflect)] pub struct TextureAtlas { - /// Texture atlas handle + /// Texture atlas layout handle pub layout: Handle, /// Texture atlas section index pub index: usize, diff --git a/examples/2d/sprite_sheet.rs b/examples/2d/sprite_sheet.rs index 5aeca48f2290a..d4f6e15f0043e 100644 --- a/examples/2d/sprite_sheet.rs +++ b/examples/2d/sprite_sheet.rs @@ -39,11 +39,11 @@ fn animate_sprite( fn setup( mut commands: Commands, asset_server: Res, - mut texture_atlases: ResMut>, + mut texture_atlas_layouts: ResMut>, ) { let texture = asset_server.load("textures/rpg/chars/gabe/gabe-idle-run.png"); - let atlas = TextureAtlasLayout::from_grid(Vec2::new(24.0, 24.0), 7, 1, None, None); - let texture_atlas = texture_atlases.add(atlas); + let layout = TextureAtlasLayout::from_grid(Vec2::new(24.0, 24.0), 7, 1, None, None); + let texture_atlas_layout = texture_atlas_layouts.add(layout); // Use only the subset of sprites in the sheet that make up the run animation let animation_indices = AnimationIndices { first: 1, last: 6 }; commands.spawn(Camera2dBundle::default()); @@ -51,7 +51,7 @@ fn setup( SpriteSheetBundle { texture, atlas: TextureAtlas { - layout: texture_atlas, + layout: texture_atlas_layout, index: animation_indices.first, }, transform: Transform::from_scale(Vec3::splat(6.0)), diff --git a/examples/2d/texture_atlas.rs b/examples/2d/texture_atlas.rs index ff4ce4b9cc457..6b5e4eab57529 100644 --- a/examples/2d/texture_atlas.rs +++ b/examples/2d/texture_atlas.rs @@ -40,7 +40,6 @@ fn check_textures( mut events: EventReader>, ) { // Advance the `AppState` once all sprite handles have been loaded by the `AssetServer` - // and that the the font has been loaded by the `FontSystem`. for event in events.read() { if event.is_loaded_with_dependencies(&rpg_sprite_folder.0) { next_state.set(AppState::Finished); @@ -207,7 +206,7 @@ fn create_texture_atlas( sampling: Option, textures: &mut ResMut>, ) -> (TextureAtlasLayout, Handle) { - // Build a `TextureAtlas` using the individual sprites + // Build a texture atlas using the individual sprites let mut texture_atlas_builder = TextureAtlasBuilder::default().padding(padding.unwrap_or_default()); for handle in folder.handles.iter() { @@ -223,14 +222,14 @@ fn create_texture_atlas( texture_atlas_builder.add_texture(Some(id), texture); } - let (texture_atlas, texture) = texture_atlas_builder.finish().unwrap(); + let (texture_atlas_layout, texture) = texture_atlas_builder.finish().unwrap(); let texture = textures.add(texture); // Update the sampling settings of the texture atlas let image = textures.get_mut(&texture).unwrap(); image.sampler = sampling.unwrap_or_default(); - (texture_atlas, texture) + (texture_atlas_layout, texture) } /// Create and spawn a sprite from a texture atlas