Skip to content

Commit

Permalink
small code improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
ManevilleF committed Jul 8, 2022
1 parent 725cba2 commit d506de5
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions crates/bevy_sprite/src/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,19 +474,15 @@ pub fn prepare_sprites(
z_order = extracted_sprite.transform.translation.z;
}
// if start != end, there is one last batch to process
if white_start != white_end {
let [start, end] = match current_batch_colored {
true => [&mut colored_start, &mut colored_end],
false => [&mut white_start, &mut white_end],
};
if *start != *end {
commands.spawn().insert(SpriteBatch {
range: white_start..white_end,
range: *start..*end,
image_handle_id: current_batch_handle,
colored: false,
z_order,
});
}
if colored_start != colored_end {
commands.spawn().insert(SpriteBatch {
range: colored_start..colored_end,
image_handle_id: current_batch_handle,
colored: true,
colored: current_batch_colored,
z_order,
});
}
Expand Down

0 comments on commit d506de5

Please sign in to comment.