bevy/crates/bevy_sprite
Ida Iyes 53157c0801 Sprite: allow using a sub-region (Rect) of the image (#6014)
Very small change that improves the usability of `Sprite`.

Before this PR, the only way to render a portion of an `Image` was to create a `TextureAtlas` and use `TextureAtlasSprite`/`SpriteSheetBundle`. This can be very annoying for one-off use cases, like if you just want to remove a border from an image, or something. Using `Sprite`/`SpriteBundle` always meant that the entire full image would be rendered.

This PR adds an optional `rect` field to `Sprite`, allowing a sub-rectangle of the image to be rendered. This is similar to how texture atlases work, but does not require creating a texture atlas asset, making it much more convenient and efficient for quick one-off use cases.

Given how trivial this change is, it really felt like missing functionality in Bevy's sprites API. ;)

## Changelog

Added:
 - `rect` field on `Sprite`: allows rendering a portion of the sprite's image; more convenient for one-off use cases, than creating a texture atlas.
2022-09-18 22:49:27 +00:00
..
src Sprite: allow using a sub-region (Rect) of the image (#6014) 2022-09-18 22:49:27 +00:00
Cargo.toml unused dep references? (#5954) 2022-09-18 15:49:49 +00:00