Nilirad / bevy_prototype_lyon

Draw 2D shapes in Bevy
Apache License 2.0
702 stars 87 forks source link

Is it possible to combine multiple shapes and treat them as a single shape? #150

Open lordbenedikt opened 2 years ago

lordbenedikt commented 2 years ago

I'm using this library to draw debug_shapes. Some of the shapes can't be represented by any of the provided shape types alone. Could they be combined though, it would perfectly work. Is it possible to do that?

zimond commented 2 years ago

You can use a PathBuilder

lordbenedikt commented 2 years ago

What if I need a shape that isn't made up of a continuous line i.e. an X?

zimond commented 2 years ago

@lordbenedikt you could just call .move_to(), each call starts a new segment. This is identical to the concept of path building in the SVG spec.

lordbenedikt commented 2 years ago

@zimond thanks, I didn't know about that!

enaut commented 2 years ago

But it would be great to impl Add<PathBuilder> for PathBuilder so I could predefine two unbuilt paths and combine the shapes. Or do I completely misunderstand the concept?