Merge SpriteBundle and TextureAtlasBundle #7123
Labels
A-Rendering
Drawing game state to the screen
C-Enhancement
A new feature
C-Usability
A simple quality-of-life change that makes Bevy easier to use
What problem does this solve or what need does it fill?
My game is composed of entities that contain a
SpriteBundle
bundle or aSpriteSheetBundle
bundle.When I want to update the color of an entity, I need to check every time if it contains a
Sprite
bundle or aTextureAtlasSprite
bundle to be able to set the innercolor
field of these components. I don't want to have to make this check, because functionally it doesn't matter to me if an entity is rendered via a Sprite or a SpriteSheet, I just want to change the color of the texture.Basically I believe the
Sprite
andTextureAtlasSprite
components contain data that is too coupled.Ideally I would like to be able to set
Color
only once for the entity, and then have the color be propagated to any sprite bundle of the entity. Same for 'anchor' or other sprite-related fields likeflip_x
, etc.What solution would you like?
I think i would like to see most fields common to 'Sprite' and 'TextureAtlasSprite' grouped into a separate component.
Something like:
And then change the bundles into:
and then all sprite-based entities can just use the
SpriteBundle
, instead of having separateSpriteBundle
orTextureAtlasBundle
.This way I can change the
color
of all sprite-based entities without having to worry if they were created using a texture-atlas or not (which is just an inner implementation detail)The solution you propose for the problem presented.
What alternative(s) have you considered?
sprite.color
ortextureAtlasSprite.color
, but that seems overly complicated (some entities do not need a color) + the actual problem is that theSprite
andTextureAtlasSprite
components are doing too much, some information should be shared between them.The text was updated successfully, but these errors were encountered: