Crate cuicui_layout
source ·Expand description
Layouting system for bevy cuicui.
The layouting system is very dumb. It is based on Container
s.
A Container
layouts its content in either a column or a row.
The individual items are positioned according to:
Container::align
: The container’s childrenAlignment
.Container::distrib
: The container’s childrenDistribution
.Container::flow
: The direction in which the container’s childrenFlow
.
By default, items are aligned at the center of the container, distributed on the flow direction evenly within the container.
All things in a cuicui layout has a known size. This is why everything needs to live in a root container of a fixed size.
That’s it! Now make a nice UI using bevy.
Re-exports
pub use dsl::LayoutDsl;
Modules
- Bevy [
Bundle
]s grouping components used by the layouting systems. - Debug overlay for
cuicui_layout
. - The
LayoutDsl
type used to bring layout bundles to thecuicui_dsl::dsl
macro. - Functions to simplify using
dsl::LayoutDsl
.
Macros
- Reorganize rust method syntax to play wonderfully with bevy’s hierarchy spawning mechanism.
Structs
- Mark
compute_layout
as added byPlugin
. - An error caused by a bad layout.
compute_layout
and systems added byadd_content_sized
.- Parameters of a container, ie: a node that contains other nodes.
- The system added by
add_content_sized
forS
. - All systems added by
add_content_sized
. - Stores the tick of the last time
compute_layout
ran. - Position and size of a
Node
as computed by the layouting algo. - Use this camera’s logical size as the root container size.
- A
Node
that can’t have children. - Whether a
apply_deferred
needs to run after the last run ofupdate_leaf_nodes
. - Add layout-related sets and systems to the
Update
schedule. - A root
Container
. - Set this
Root
to track theLayoutRootCamera
’s size. - A
T
that applies to thewidth
andheight
of something.
Enums
- The cross axis alignment. Aka alignment.
- The main axis alignment. Aka distribution.
- The layout direction of a
Container
. - A constraint on an axis of a terminal
Node
(ie: doesn’t have aChildren
constraint). - A [
Component
] integrating the attached [Entity
] incuicui_layout
. - A constraint on an axis of containers.
Traits
- Extends [
App
] to support addingComputeContentSize
. - The static version of whatever implements
ComputeContentSize
. - A [
SystemParam
] to compute the size of content-sized layoutNode
s. - The type used in a
dsl!
macro to create bundles to spawn when creating the entity tree. - Convert this into an [
EntityCommands
].
Functions
- Run the layout algorithm.
- A run condition to tell whether it’s necessary to recompute layout.