Expand description
This crate contains Bevy’s UI system, which can be used to create UI for both 2D and 3D games
§Basic usage
Spawn UI elements with widget::Button, ImageNode, Text and Node
This UI is laid out with the Flexbox and CSS Grid layout models (see https://cssreference.io/flexbox/)
Re-exports§
- pub use interaction_states::Checkable;
- pub use interaction_states::Checked;
- pub use interaction_states::InteractionDisabled;
- pub use interaction_states::Pressed;
- pub use gradients::*;
- pub use measurement::*;
- pub use ui_transform::*;
Modules§
- debug
- experimental
- Experimental features are not yet stable and may change or be removed in the future.
- gradients
- interaction_states 
- measurement
- picking_backend bevy_ui_picking_backend
- A picking backend for UI nodes.
- prelude
- The UI prelude.
- ui_transform 
- update
- This module contains systems that update the UI when something changes
- widget
- This module contains the basic building blocks of Bevy’s UI
Structs§
- BackgroundColor 
- The background color of the node
- BorderColor 
- The border color of the UI node.
- BorderRadius 
- Used to add rounded corners to a UI node. You can set a UI node to have uniformly rounded corners or specify different radii for each corner. If a given radius exceeds half the length of the smallest dimension between the node’s height or width, the radius will calculated as half the smallest dimension.
- BoxShadow
- List of shadows to draw for a Node.
- CalculatedClip 
- The calculated clip of the node
- ComputedNode 
- Provides the computed size and layout properties of the node.
- ComputedUiRender Target Info 
- Derived information about the render target for this UI node.
- ComputedUiTarget Camera 
- Derived information about the camera target for this UI node.
- DefaultUiCamera 
- GlobalZIndex 
- GlobalZIndexallows a- Nodeentity anywhere in the UI hierarchy to escape the implicit draw ordering of the UI’s layout tree and be rendered above or below other UI nodes. Nodes with a- GlobalZIndexof greater than 0 will be drawn on top of nodes without a- GlobalZIndexor nodes with a lower- GlobalZIndex. Nodes with a- GlobalZIndexof less than 0 will be drawn below nodes without a- GlobalZIndexor nodes with a greater- GlobalZIndex.
- GridPlacement 
- Represents the position of a grid item in a single axis.
- GridTrack 
- A GridTrackis a Row or Column of a CSS Grid. This struct specifies what size the track should be. See below for the different “track sizing functions” you can specify.
- IsDefaultUiCamera 
- Marker used to identify default cameras, they will have priority over the PrimaryWindowcamera.
- LayoutConfig 
- This component can be added to any UI node to modify its layout behavior.
- LayoutContext 
- Node
- The base component for UI entities. It describes UI layout and style properties.
- NodeQuery 
- Main query for ui_focus_system
- NodeQuery Item 
- Automatically generated WorldQueryitem type forNodeQuery, returned when iterating over query results.
- NodeQuery Read Only 
- Automatically generated WorldQuerytype for a read-only variant ofNodeQuery.
- NodeQuery Read Only Item 
- Automatically generated WorldQueryitem type forNodeQueryReadOnly, returned when iterating over query results.
- Outline
- The Outlinecomponent adds an outline outside the edge of a UI node. Outlines do not take up space in the layout.
- Overflow
- Whether to show or hide overflowing items
- OverflowClip Margin 
- The bounds of the visible area when a UI node is clipped.
- OverrideClip 
- UI node entities with this component will ignore any clipping rect they inherit,
the node will not be clipped regardless of its ancestors’ Overflowsetting.
- RelativeCursor Position 
- A component storing the position of the mouse relative to the node, (0., 0.) being the center and (0.5, 0.5) being the bottom-right If the mouse is not over the node, the value will go beyond the range of (-0.5, -0.5) to (0.5, 0.5)
- RepeatedGrid Track 
- Represents a possibly repeated GridTrack.
- ResolvedBorder Radius 
- Represents the resolved border radius values for a UI node.
- ScrollPosition 
- The scroll position of the node. Values are in logical pixels, increasing from top-left to bottom-right.
- ShadowStyle 
- State
- Contains entities whose Interaction should be set to None
- UiPlugin
- The basic plugin for Bevy UI
- UiPosition
- Responsive position relative to a UI node.
- UiRect
- A type which is commonly used to define margins, paddings and borders.
- UiScale
- The current scale of the UI.
- UiStack
- The current UI stack, which contains all UI nodes ordered by their depth (back-to-front).
- UiTargetCamera 
- Indicates that this root Nodeentity should be rendered to a specific camera.
- ZIndex
- Indicates that this Nodeentity’s front-to-back ordering is not controlled solely by its location in the UI hierarchy. A node with a higher z-index will appear on top of sibling nodes with a lower z-index.
Enums§
- AlignContent 
- Used to control how items are distributed.
- AlignItems 
- Used to control how each individual item is aligned by default within the space they’re given.
- AlignSelf 
- Used to control how the specified item is aligned within the space it’s given.
- BoxSizing
- Which part of a Node’s box length styles like width and height control
- Display
- Defines the layout model used by this node.
- FlexDirection 
- Defines how flexbox items are ordered within a flexbox
- FlexWrap 
- Defines if flexbox items appear on a single line or on multiple lines
- FocusPolicy 
- Describes whether the node should block interactions with lower nodes
- GridAuto Flow 
- Controls whether grid items are placed row-wise or column-wise as well as whether the sparse or dense packing algorithm is used.
- GridPlacement Error 
- Errors that occur when setting constraints for a GridPlacement
- GridTrack Repetition 
- How many times to repeat a repeated grid track
- Interaction
- Describes what type of input interaction has occurred for a UI node.
- JustifyContent 
- Used to control how items are distributed.
- JustifyItems 
- Used to control how each individual item is aligned by default within the space they’re given.
- JustifySelf 
- Used to control how the specified item is aligned within the space it’s given.
- LayoutError 
- MaxTrackSizing Function 
- MinTrackSizing Function 
- OverflowAxis 
- Whether to show or hide overflowing items
- OverflowClip Box 
- Used to determine the bounds of the visible area when a UI node is clipped.
- PositionType 
- The strategy used to position this node
- UiSystems
- The label enum labeling the types of systems in the Bevy UI
- Val
- Represents the possible value types for layout properties.
- ValArithmeticError 
- ValParseError 
Traits§
Functions§
- auto
- Returns a Val::Autowhere the value is automatically determined based on the context and otherNodeproperties.
- clip_check_ recursive 
- Walk up the tree child-to-parent checking that pointis not clipped by any ancestor node. Ifentityhas anOverrideClipcomponent it ignores any inherited clipping and returns true.
- percent
- Returns a Val::Percentrepresenting a percentage of the parent node’s length along a specific axis.
- px
- Returns a Val::Pxrepresenting a value in logical pixels.
- ui_focus_ system 
- The system that sets Interaction for all UI elements based on the mouse cursor activity
- ui_layout_ system 
- Updates the UI’s layout tree, computes the new layout geometry and then updates the sizes and transforms of all the UI nodes.
- vh
- Returns a Val::Vhrepresenting a percentage of the viewport height.
- vmax
- Returns a Val::VMaxrepresenting a percentage of the viewport’s larger dimension.
- vmin
- Returns a Val::VMinrepresenting a percentage of the viewport’s smaller dimension.
- vw
- Returns a Val::Vwrepresenting a percentage of the viewport width.