mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
d38d8a148a
# Objective Remove some unnecessary coupling between `DynamicTextureAtlasBuilder` and `bevy_asset`. ## Solution Remove the dependency of `DynamicTextureAtlasBuilder::add_texture` to `bevy_asset`, by directly passing the `Image` of the atlas to mutate, instead of passing separate `Assets<Image>` and `Handle<Image>` for the function to do the lookup by itself. The lookup can be done from the caller, and this allows using the builder in contexts where the `Image` is not stored inside `Assets`. Clean-up a bit the font atlas files by introducing a `PlacedGlyph` type storing the `GlyphId` and its `SubpixelOffset`, which were otherwise always both passed as function parameters and the pair used as key in hash maps. ## Testing There's no change in behavior. --- ## Changelog - Added a `PlacedGlyph` type aggregating a `GlyphId` and a `SubpixelOffset`. That type is now used as parameter in a few text atlas APIs, instead of passing individual values. ## Migration Guide - Replace the `glyph_id` and `subpixel_offset` of a few text atlas APIs by a single `place_glyph: PlacedGlyph` parameter trivially combining the two. |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |