Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why aren't Fill and Stroke housed in ShapeBundle? #207

Closed
akappel opened this issue Mar 9, 2023 · 2 comments
Closed

Why aren't Fill and Stroke housed in ShapeBundle? #207

akappel opened this issue Mar 9, 2023 · 2 comments

Comments

@akappel
Copy link

akappel commented Mar 9, 2023

Obviously this is already merged (via #198) and out in the wild, but I'm trying to understand why Fill and Stroke were pulled out of ShapeBundle? The idea of making them components was a good one, and the updated ergonomics of GeometryBuilder seems sound. But now I have two extra components on my top-level bundle that weren't needed previously, and are only useful in the context of the ShapeBundle.

As an example, my PinballBundle goes from:

#[derive(Component)]
pub struct Pinball;

#[derive(Bundle)]
pub struct PinballBundle {
    pinball: Pinball,
    rigidbody: RigidBody,
    collider: Collider,
    friction: Friction,
    #[bundle]
    shape_bundle: ShapeBundle,
}

to:

#[derive(Component)]
pub struct Pinball;

#[derive(Bundle)]
pub struct PinballBundle {
    pinball: Pinball,
    rigidbody: RigidBody,
    collider: Collider,
    friction: Friction,
    #[bundle]
    shape_bundle: ShapeBundle,
    fill: Fill,
    stroke: Stroke,
}

Not a huge deal, just liked having it all packaged under ShapeBundle. Since I use ShapeBundle in other places as well, it feels like I'll need to create an intermediary bundle to join them back together.

@Nilirad
Copy link
Owner

Nilirad commented Mar 9, 2023

It's because you may not always want to have both components at the same time, and Bevy does not have bundles with optional components.

We may add a different bundle for each draw mode, but I have to think about it.

@akappel
Copy link
Author

akappel commented Mar 9, 2023

Ah okay, makes sense. Thanks for the background! A bundle for each draw mode sounds promising, but for now I'll just create that intermediary bundle with both 👍 Thanks!

@akappel akappel closed this as completed Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants