bevy_rectray
A minimal 2d layout system (that works in 3d!) for bevy.
Getting Started
First add RectrayPlugin
.
app.add_plugins
Then add RectrayFrame
to a parent entity.
This effectively creates a 2d rectangular space around
the local x
and y
axis of the entity's Transform
.
commands.spawn
To place descendant entities inside the frame, add Transform2D
and Dimension
next to entities
with Transform
s.
commands.spawn
Since we only operate on Transform
, bevy_rectray
works in Transform - Transform2d - Transform
sandwich situations.
Integration
bevy_rectray
is minimal and does not magically react to changes in bevy components.
We take in Transform2D
and Dimension
and produces Transform
and RotatedRect
.
Some of those data can come from external sources.
For example if you want to make all Sprite
s take up space of its Image
or custom_size
,
add a system like this manually:
If you want the opposite behavior, you can update the size of a sprite from
the outputted RotatedRect::dimension
.
Containers
Add RectrayContainerBundle
to put child items in a Layout
.
See module level documentation for details.
Showcase
- Place items on anchors of parents
- Put 3d meshes in a layout
- Place individual words to form a paragraph
Versions
bevy | bevy_rectray |
---|---|
0.14 | 0.1 |
0.15 | 0.2-latest |
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.