Module ambient_ui_native::prelude
source · Expand description
A prelude for users of the crate. Imports all the most commonly used types and functions.
Modules
- Element is a React-inspired virtual tree library for the Ambient runtime.
Structs
- A full-screen alert dialog that the user must acknowledge.
- An editor for a fixed-size array.
- An entry in a Bookcase.
- A button UI element.
- A checkbox.
- An area that tracks mouse events.
- An editor for a value that can be parsed from a string, but with custom parsing and stringification.
- Contains a single element with a background color and click area.
- A docking layout, where each child specifies which side of the parent it should be docked to. It is top-down: it starts with a given area (say the screen) and then divides it into smaller pieces with each new element added to it.
- A dropdown element: shows the
dropdown
whenshow
is specified. - A dropdown select element. Presents a button next to
content
that, when clicked, shows a dropdown with the items initems
. - An editor for EditableDuration.
- A duration that can be edited.
- Legacy newtype for FlowColumn.
- Options for the Editor type.
- A full-screen prompt dialog to edit a value.
- A row with a title and an element, used as part of larger editors.
- A rendered ElementComponent instance.
- A tree of instantiated Elements.
- A FixedGrid is a grid of elements with a fixed stride.
- A flow layout. It is bottom-up: it auto-resizes itself to fit its constituent components.
- A FlowColumn is a Flow that is oriented vertically.
- Keeps track of which element has focus.
- Provides a context for focusable UI elements.
- A FontAwesome icon.
- Wrap multiple Elements in a flat hierarchy.
- Hooks are a way to hook into the state and lifecycle of an Element.
- An element that will invoke a callback when a hotkey is pressed.
- A slider for an integer value.
- A simple UI line. Use components like
line_from
,line_to
,line_width
,background_color
,border_color
,border_radius
andborder_thickness
to control its appearance. - An editor for a list of items that implement Editor; each item can be edited, moved up or down, or deleted.
- A DropdownSelect that shows the current item for you automatically.
- Measures the size of its inner element and calls the callback when it changes.
- Memoize the ElementComponent, such that it is only re-rendered if the component changes.
- A MinimalListEditorWithItemEditor that uses the default editor for the items.
- A single item in a list editor
- A configurable list editor that allows you to specify the editor for the items, and to provide other preset options.
- Delegates a type editor to edit in a new
screen
. - Contains several elements with a background color and click area.
- An editor for a value that can be parsed from a string.
- A full-screen prompt dialog that the user must acknowledge.
- A simple UI rect. Use components like
width
,height
,background_color
,border_color
,border_radius
andborder_thickness
to control its appearance. - Contains an element with a background color and click area.
- A scroll area that can be used to scroll its child.
- A simple separator, similar to
<hr>
in HTML. - A slider for a floating-point value.
- An editor for SystemTime.
- A header bar of tabs. Does not contain the tab content.
- A set of tabs. Contains a
TabBar
and the content of the selected tab. - A text editor.
- Shows an animated progress bar to indicate that progress is being made and has not frozen.
- A tooltip element: shows the
tooltip
when theinner
is hovered. - A base element for all UI elements. It contains all the components needed for a UI element to work.
- A Dock that is always the size of the window.
- Wraps the inner Element. This is useful for introducing an intermediate component node in a tree.
Enums
- The callback invoked when a button is clicked.
- The style of a button.
- The state of a mouse button.
- Sizing config of a scroll area
Constants
- Character code for the “down chevron” icon.
- Character code for the “left chevron” icon.
- Character code for the “right chevron” icon.
- Character code for the “up chevron” icon.
- Character code for the “add” icon.
- Character code for the “delete” icon.
- Character code for the “move down” icon.
- Character code for the “move up” icon.
- Default rounding of corners.
- Default margin/padding.
Traits
- A trait for types that can be edited in the UI.
- The base trait for all element components. These are similar to React components.
- A convenience trait for converting an ElementComponent into an Element.
- A trait that adds some default styles to elements.
- A trait that provides helper methods for UI elements.
Functions
- Align horizontal begin: Layout alignment: horizontal begin.
- Align horizontal center: Layout alignment: horizontal center.
- Align horizontal end: Layout alignment: horizontal end.
- Align vertical begin: Layout alignment: vertical begin.
- Align vertical center: Layout alignment: vertical center.
- Align vertical end: Layout alignment: vertical end.
- The color used for the background of the app.
- Background color: Background color of an entity with a
rect
component. - Border color: Border color of an entity with a
rect
component. - Border radius: Radius for each corner of an entity with a
rect
component. - Border thickness: Border thickness of an entity with a
rect
component. - Cast shadows: If attached, this entity will cast shadows.
- Helper for constructing a Cb.
- Children: The children of this entity.
- Color: This entity will be tinted with the specified color if the color is not black.
- Cursor position: Absolute mouse cursor position in screen-space. This is the logical position. Multiply by the
window_scale_factor
to get the physical position. - A color slightly darker than app_background_color.
- Cylindrical billboard Z: If attached, this ensures this entity is always aligned with the camera, except on the Z-axis.
- Decal material from URL: Load a Decal material from the URL and attach it to this entity.
- Description: A human-friendly description for this entity.
- Docking bottom: Layout docking: bottom.
- Docking fill: Layout docking: fill.
- Docking left: Layout docking: left.
- Docking right: Layout docking: right.
- Docking top: Layout docking: top.
- Don’t automatically despawn on module unload: Indicates that this entity shouldn’t be despawned when the module that spawned it unloads.
- Don’t store: Indicates that this entity shouldn’t be stored on disk.
- Double-sided: If this is set, the entity will be rendered with double-sided rendering.
- Delta Time: How long the previous tick took in seconds.
- Element: The identifier of the
Element
that controls this entity. - Element unmanaged children: If this is set, the user is expected to manage the children of the
Element
themselves. - The error color.
- Euler rotation: The Euler rotation of this entity in ZYX order.
- Fit horizontal children: Layout fit: horizontal children.
- Fit horizontal none: Layout fit: horizontal none.
- Fit horizontal parent: Layout fit: horizontal parent.
- Fit vertical children: Layout fit: vertical children.
- Fit vertical none: Layout fit: vertical none.
- Fit vertical parent: Layout fit: vertical parent.
- Fog color: The color of the fog for this
sun
. - Fog density: The density of the fog for this
sun
. - Fog height fall-off: The height at which the fog will fall off (i.e. stop being visible) for this
sun
. - Font family: Font family to be used. Can either be ‘Default’, ‘FontAwesome’, ‘FontAwesomeSolid’, ‘Code’ or a url to a font.
- Font size: Size of the font.
- Font style: One of Bold, BoldItalic, Medium, MediumItalic, Regular, Italic, Light or LightItalic.
- GPU UI size: Upload the width and height of this UI element to the GPU.
- Height: The height of a UI element.
- ID: The ID of the entity.
- Inverse Local to World: Converts a world position to a local position.
- Is book file: This is a file in a
layout_bookcase
. - Joint Matrices: Contains the matrices for each joint of this skinned mesh.
- Joints: Contains the joints that comprise this skinned mesh.
- Bookcase layout: Min-max bookcase layout.
- Dock layout: Top-down dock layout.
- Flow layout: Bottom-up flow layout.
- Layout width to children: Width to children.
- Light ambient: The ambient light color of the
sun
. - Light diffuse: The diffuse light color of the
sun
. - Line from: Start point of a line.
- Line to: End point of a line.
- Line width: Width of line.
- Local to Parent: Transformation from the entity’s local space to the parent’s space.
- Local to World: Transformation from the entity’s local space to worldspace.
- Local user ID: The user ID of the local player.
- Look-at target: The position that this entity should be looking at.
- Look-at up: When combined with
lookat_target
, the up vector for this entity. - Main scene: If attached, this entity belongs to the main scene.
- Map seed: A random number seed for this map.
- Margin: Layout margin: [top, right, bottom, left].
- Maximum height: The maximum height of a UI element.
- Maximum width: The maximum width of a UI element.
- Mesh to Local: Transformation from mesh-space to the entity’s local space.
- Mesh to local from size: Update the
mesh_to_local
based on the width and height of this entity. - Mesh to World: Transformation from mesh-space to world space.
- Minimum height: The minimum height of a UI element.
- Minimum width: The minimum width of a UI element.
- Mouse over: The number of mouse cursors that are currently over this entity.
- Mouse pickable max: This entity can be clicked by the mouse, and this component defines the max AABB bound of the click area.
- Mouse pickable min: This entity can be clicked by the mouse, and this component defines the min AABB bound of the click area.
- Name: A human-friendly name for this entity.
- Orientation horizontal: Layout orientation: horizontal.
- Orientation vertical: Layout orientation: vertical.
- Outline: If attached, this entity will be rendered with an outline with the color specified.
- Outline (recursive): If attached, this entity and all of its children will be rendered with an outline with the color specified.
- Overlay: If attached, this entity will be rendered with an overlay.
- Padding: Layout padding: [top, right, bottom, left].
- Parent: The parent of this entity.
- PBR material from URL: Load a PBR material from the URL and attach it to this entity.
- Player: This entity is a player.
- The primary color.
- Project Name: The name of the project, from the manifest.
- Rect: If attached to an entity, the entity will be converted to a UI rectangle, with optionally rounded corners and borders.
- Reset scale: If attached to a transform hierarchy, the scale will be reset at that point, with only rotation/translation considered.
- Rotation: The rotation of this entity.
- Scale: The scale of this entity.
- Screen: This entity will be treated as a screen. Used by the Screen ui component.
- The secondary color.
- Selectable: If attached, this object can be selected in the editor.
- Sky: Add a realistic skybox to the scene.
- Snap to ground: This object should automatically be moved with the terrain if the terrain is changed.
- Space between items: Space between items in a layout.
- Spherical billboard: If attached, this ensures that this entity is always aligned with the camera.
- Sun: Marks this entity as a sun (i.e. its rotation will be used to control the global light direction).
- Tags: Tags for categorizing this entity.
- Text: Create a text mesh on this entity.
- The color used for tooltip backgrounds.
- Translation: The translation/position of this entity.
- Transparency group: Controls when this transparent object will be rendered. Transparent objects are sorted by
(transparency_group, z-depth)
. - UI scene: If attached, this entity belongs to the UI scene.
- A hook that returns the current focus state for this element and a callback to set the focus state.
- A hook that returns the current window logical resolution (i.e. taking DPI scaling into account)
- A hook that returns the current window physical resolution (i.e. not taking DPI scaling into account)
- User ID: An identifier attached to all things owned by a user, and supplied by the user.
- Water: Add a realistic water plane to this entity.
- Width: The width of a UI element.
- Window logical size: The logical size is the physical size divided by the scale factor.
- Window physical size: The physical size is the actual number of pixels on the screen.
- Window scale factor: The DPI/pixel scale factor of the window.
- Converts the given element into a rect.
Type Definitions
- The type of function invoked by a button.
- A helper type for callbacks that wraps around a function type with an
Arc
that implementsDebug
. - Callback for when an editor changes its value.
- A ParseableInput for f32.
- A ParseableInput for i32.
- A ParseableInput for u32.
- A ParseableInput for u64.
- A ParseableInput for usize.
Attribute Macros
- Helper macro to implement a
ElementComponent
with a pure free function.