Module prelude

Source

Re-exports§

pub use crate::create_bevy_app;
pub use wasm_bindgen;
pub use crate::assets::*;
pub use crate::audio::*;
pub use crate::codes::*;
pub use crate::input::*;
pub use crate::pixels::*;
pub use crate::render::*;

Modules§

adapter
A collection of common adapters for piping the result of a system.
lifetimeless
prelude
The Bevy Core Prelude.
system_adapter
A collection of common adapters for piping the result of a system.

Macros§

debug
Constructs an event at the debug level.
debug_span
Constructs a span at the debug level.
error
Constructs an event at the error level.
error_span
Constructs a span at the error level.
info
Constructs an event at the info level.
info_span
Constructs a span at the info level.
log
trace
Constructs an event at the trace level.
trace_span
Constructs a span at the trace level.
warn
Constructs an event at the warn level.
warn_span
Constructs a span at the warn level.

Structs§

AddChild
Command that adds a child to an entity
Added
A filter on a component that only retains results added after the system last ran.
AncestorIter
An Iterator of Entitys over the ancestors of an Entity.
AnyOf
The AnyOf query parameter fetches entities with any of the component types included in T.
App
A container of app logic and data.
AppTypeRegistry
The Resource that stores the App’s TypeRegistry.
Axis
Stores the position data of the input devices of type T.
BSpline
A spline interpolated continuously across the nearest four control points. The curve does not pass through any of the control points.
BVec2
A 2-dimensional bool vector mask.
BVec3
A 3-dimensional bool vector mask.
BVec4
A 4-dimensional bool vector mask.
Bezier
A spline composed of a series of cubic Bezier curves.
CardinalSpline
A spline interpolated continuously across the nearest four control points, with the position of the curve specified at every control point and the tangents computed automatically.
ChangeTrackersDeprecated
WorldQuery that tracks changes and additions for component T.
Changed
A filter on a component that only retains results added or mutably dereferenced after the system last ran.
ChildBuilder
Struct for building children onto an entity
Children
Contains references to the child entities of this entity.
ClearChildren
Command that clear all children from an entity.
Closure
A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure.
CombinatorSystem
A System defined by combining two other systems. The behavior of this combinator is specified by implementing the Combine trait. For a full usage example, see the docs for Combine.
CommandQueue
Densely and efficiently stores a queue of heterogenous types implementing Command.
Commands
A Command queue to perform impactful changes to the World.
CubicSegment
A segment of a cubic curve, used to hold precomputed coefficients for fast interpolation.
CursorEntered
An event that is sent whenever the user’s cursor enters a window.
CursorLeft
An event that is sent whenever the user’s cursor leaves a window.
CursorMoved
An event reporting that the mouse cursor has moved inside a window.
DebugName
Convenient query for giving a human friendly name to an entity.
DebugNameItem
Automatically generated WorldQuery item type for DebugName, returned when iterating over query results.
DefaultPlugins
This plugin group will add all the default plugins for a Bevy application:
Deferred
A SystemParam that stores a buffer which gets applied to the World during apply_system_buffers. This is used internally by Commands to defer World mutations.
DescendantIter
An Iterator of Entitys over the descendants of an Entity.
Despawn
DespawnChildrenRecursive
Despawns the given entity’s children recursively
DespawnRecursive
Despawns the given entity and all its children recursively
Entity
Lightweight identifier of an entity.
EntityCommands
A list of commands that will be run to modify an entity.
EventReader
Reads events of type T in order and tracks which events have already been read.
EventWriter
Sends events of type T.
Events
An event collection that represents the events that occurred within the last two Events::update calls. Events can be written to using an EventWriter and are typically cheaply read using an EventReader.
ExclusiveFunctionSystem
A function system that runs with exclusive World access.
FixedTime
The amount of time that must pass before the fixed timestep schedule is run again.
FrameCount
Maintains a count of frames rendered since the start of the application.
FrameCountPlugin
Adds frame counting functionality to Apps.
FunctionSystem
The System counter part of an ordinary function.
Gamepad
A gamepad with an associated ID.
GamepadAxis
An axis of a Gamepad.
GamepadButton
A button of a Gamepad.
Gamepads
A collection of connected Gamepads.
GetOrSpawn
GlobalTransform
Describe the position of an entity relative to the reference frame.
Hermite
A spline interpolated continuously between the nearest two control points, with the position and velocity of the curve specified at both control points. This curve passes through all control points, with the specified velocity which includes direction and parametric speed.
HierarchyPlugin
The base plugin for handling Parent and Children components
IVec2
A 2-dimensional vector.
IVec3
A 3-dimensional vector.
IVec4
A 4-dimensional vector.
In
Wrapper type to mark a SystemParam as an input.
InitResource
Input
A “press-able” input of type T.
Insert
InsertChildren
Command that inserts a child at a given index of a parent’s children, shifting following children back
InsertOrSpawnBatch
InsertResource
IsExclusiveFunctionSystem
IsFunctionSystem
JsError
Convenience type for use on exported fn() -> Result<T, JsError> functions, where you wish to throw a JavaScript Error object.
JsValue
Representation of an object owned by JS.
Local
A system local SystemParam.
LogComponents
Command to log the components of a given entity. See EntityCommands::log_components.
Mat2
A 2x2 column major matrix.
Mat3
A 3x3 column major matrix.
Mat4
A 4x4 column major matrix.
MinimalPlugins
This plugin group will add the minimal plugins for a Bevy application:
Mut
Unique mutable borrow of an entity’s component
Name
Component used to identify an entity. Stores a hash for faster comparisons.
NextState
The next state of State<S>.
NonSend
Shared borrow of a non-Send resource.
NonSendMarker
A dummy type that is !Send, to force systems to run on the main thread.
NonSendMut
Unique borrow of a non-Send resource.
OnEnter
The label of a Schedule that runs whenever State<S> enters this state.
OnExit
The label of a Schedule that runs whenever State<S> exits this state.
OnUpdate
A SystemSet that will run within CoreSet::Update when this state is active.
Or
A filter that tests if any of the given filters apply.
ParallelCommands
An alternative to Commands that can be used in parallel contexts, such as those in Query::par_iter
ParamSet
A collection of potentially conflicting SystemParams allowed by disjoint access.
Parent
Holds a reference to the parent entity of this entity. This component should only be present on entities that actually have a parent entity.
PushChildren
Command that pushes children to the end of the entity’s Children.
Quat
A quaternion representing an orientation.
Query
System parameter that provides selective access to the Component data stored in a World.
QueryState
Provides scoped access to a World state according to a given WorldQuery and query filter.
Ray
A ray is an infinite line starting at origin, going in direction.
ReceivedCharacter
An event that is sent whenever a window receives a character from the OS or underlying system.
Rect
A rectangle defined by two opposite corners.
Ref
Shared borrow of an entity’s component with access to change detection. Similar to Mut but is immutable and so doesn’t require unique access.
ReflectComponent
A struct used to operate on reflected Component of a type.
ReflectDefault
A struct used to provide the default value of a type.
ReflectDeserialize
A struct used to deserialize reflected instances of a type.
ReflectResource
A struct used to operate on reflected Resource of a type.
ReflectSerialize
A struct used to serialize reflected instances of a type.
Remove
RemoveChildren
Command that removes children from an entity, and removes that child’s parent.
RemoveParent
Command that removes the parent of an entity, and removes that entity from the parent’s Children.
RemoveResource
RemovedComponents
A SystemParam that grants access to the entities that had their T Component removed.
ReplaceChildren
Command that clear all children from an entity. And replace with the given children.
Res
Shared borrow of a Resource.
ResMut
Unique mutable borrow of a Resource.
ScanCode
The scan code of a KeyboardInput.
Schedule
A collection of systems, and the metadata and executor needed to run them in a certain order under certain conditions.
Schedules
Resource that stores Schedules mapped to ScheduleLabels.
Spawn
SpawnBatch
State
A finite-state machine whose transitions have associated schedules ([OnEnter(state)] and [OnExit(state)]).
StaticSystemParam
A helper for using system parameters in generic contexts
SystemChangeTick
A SystemParam that reads the previous and current change ticks of the system.
SystemMeta
The metadata of a System.
SystemName
Name of the system that corresponds to this crate::system::SystemState.
SystemState
Holds on to persistent state required to drive SystemParam for a System.
TaskPoolOptions
Helper for configuring and creating the default task pools. For end-users who want full control, set up TaskPoolPlugin
TaskPoolPlugin
Setup of default task pools: AsyncComputeTaskPool, ComputeTaskPool, IoTaskPool.
TaskPoolThreadAssignmentPolicy
Defines a simple way to determine how many threads to use given the number of remaining cores and number of total cores
Time
A clock that tracks how much it has advanced (and how much real time has elapsed) since its previous update and since its creation.
Timer
Tracks elapsed time. Enters the finished state once duration is reached.
TouchInput
A touch input event.
Touches
A collection of Touches.
Transform
Describe the position of an entity. If the entity has a parent, the position is relative to its parent position.
TransformBundle
A Bundle of the Transform and GlobalTransform Components, which describe the position of an entity.
TransformPlugin
The base plugin for handling Transform components
TypeRegistrationPlugin
Registration of default types to the TypeRegistry resource.
UVec2
A 2-dimensional vector.
UVec3
A 3-dimensional vector.
UVec4
A 4-dimensional vector.
ValidParentCheckPlugin
Print a warning for each Entity with a T component whose parent doesn’t have a T component.
Vec2
A 2-dimensional vector.
Vec3
A 3-dimensional vector.
Vec4
A 4-dimensional vector with SIMD support.
Window
Define how a window will be created and how it will behave.
WindowMoved
An event that is sent when a window is repositioned in physical pixels.
WindowPlugin
A Plugin that defines an interface for windowing support in Bevy.
WindowResizeConstraints
The size limits on a window.
With
Filter that selects entities with a component T.
WithEntity
Turns an EntityCommand type into a Command type.
Without
Filter that selects entities without a component T.
World
Stores and exposes operations on entities, components, resources, and their associated metadata.
WorldChildBuilder
Struct for adding children to an entity directly through the World for use in exclusive systems

Enums§

CoreSchedule
The names of the default App schedules.
CoreSet
The names of the default App system sets.
CursorIcon
The icon to display for a window’s cursor.
EulerRot
Euler rotation sequences.
FileDragAndDrop
Events related to files being dragged and dropped on a window.
GamepadAxisType
A type of a GamepadAxis.
GamepadButtonType
A type of a GamepadButton.
Ime
A Input Method Editor event.
KeyCode
The key code of a KeyboardInput.
MonitorSelection
Defines which monitor to use.
MouseButton
A button on a mouse device.
QueryComponentError
An error that occurs when retrieving a specific Entity’s component from a Query
StartupSet
The names of the default App startup sets, which live in CoreSchedule::Startup.
TimerMode
Specifies Timer behavior.
WindowPosition
Defines where window should be placed at on creation.

Traits§

BuildChildren
Trait defining how to build children
BuildChildrenTransformExt
Collection of methods similar to [BuildChildren], but preserving each entity’s GlobalTransform.
BuildWorldChildren
Trait that defines adding children to an entity directly through the World
Bundle
The Bundle trait enables insertion and removal of Components from an entity.
Combine
Customizes the behavior of a CombinatorSystem.
Command
A World mutation.
Component
A data type that can be used to store data for an entity.
Condition
A system that determines if one or more scheduled systems should run.
CubicGenerator
Implement this on cubic splines that can generate a curve from their spline parameters.
DespawnRecursiveExt
Trait that holds functions for despawning recursively down the transform hierarchy
DetectChanges
Types that can read change detection information. This change detection is controlled by DetectChangesMut types such as ResMut.
DetectChangesMut
Types that implement reliable change detection.
EntityCommand
A Command which gets executed for a given Entity.
Event
A type that can be stored in an Events<E> resource You can conveniently access events using the EventReader and EventWriter system parameter.
ExclusiveSystemParam
ExclusiveSystemParamFunction
A trait implemented for all exclusive system functions that can be used as Systems.
FromReflect
A trait that enables types to be dynamically constructed from reflected data.
FromWorld
Creates an instance of the type this trait is implemented for using data from the supplied World.
GetField
A convenience trait which combines fetching and downcasting of struct fields.
GetTupleStructField
A convenience trait which combines fetching and downcasting of tuple struct fields.
HierarchyQueryExt
An extension trait for Query that adds hierarchy related methods.
IntoPipeSystem
An extension trait providing the IntoPipeSystem::pipe method to pass input from one system into the next.
IntoSystem
Conversion trait to turn something into a System.
IntoSystemAppConfig
Types that can be converted into a SystemAppConfig.
IntoSystemAppConfigs
Types that can convert into SystemAppConfigs.
IntoSystemConfig
Types that can be converted into a SystemConfig.
IntoSystemConfigs
Types that can convert into a SystemConfigs.
IntoSystemSet
Types that can be converted into a SystemSet.
IntoSystemSetConfig
Types that can be converted into a SystemSetConfig.
IntoSystemSetConfigs
Types that can convert into a SystemSetConfigs.
JsCast
A trait for checked and unchecked casting between JS types.
Plugin
A collection of Bevy app logic and configuration.
PluginGroup
Combines multiple Plugins into a single unit.
Pod
Marker trait for “plain old data”.
ReadOnlySystem
System types that do not modify the World when run. This is implemented for any systems whose parameters all implement ReadOnlySystemParam.
ReadOnlySystemParam
A SystemParam that only reads a given World.
Reflect
The core trait of bevy_reflect, used for accessing and modifying data dynamically.
Resource
A type that can be inserted into a World as a singleton.
States
Types that can define world-wide states in a finite-state machine.
Struct
A trait used to power struct-like operations via reflection.
System
An ECS system that can be added to a Schedule
SystemBuffer
Types that can be used with Deferred<T> in systems. This allows storing system-local data which is used to defer World mutations.
SystemParam
A parameter that can be used in a System.
SystemParamFunction
A trait implemented for all functions that can be used as Systems.
SystemSet
Types that identify logical groups of systems.
TupleStruct
A trait used to power tuple struct-like operations via reflection.
UnwrapThrowExt
An extension trait for Option<T> and Result<T, E> for unwrapping the T value, or throwing a JS error if it is not available.
Zeroable
Trait for types that can be safely created with zeroed.

Functions§

any_with_component
Generates a Condition-satisfying closure that returns true if there are any entities with the given component type.
apply_state_transition
If a new state is queued in NextState<S>, this system:
apply_system_buffers
Instructs the executor to call apply_buffers on the systems that have run but not applied their buffers.
assert_is_read_only_system
Ensure that a given function is a read-only system.
assert_is_system
Ensure that a given function is a system.
bytes_of
Re-interprets &T as &[u8].
cast_slice
Cast &[A] into &[B].
dbg
System adapter that utilizes the bevy_utils::tracing::debug! macro to print the output of a system.
default
An ergonomic abbreviation for Default::default() to make initializing structs easier. This is especially helpful when combined with “struct update syntax”.
despawn_with_children_recursive
Function for despawning an entity and all its children
error
System adapter that utilizes the bevy_utils::tracing::error! macro to print the output of a system.
ignore
System adapter that ignores the output of the previous system in a pipe. This is useful for fallible systems that should simply return early in case of an Err/None.
in_state
Generates a Condition-satisfying closure that returns true if the state machine is currently in state.
info
System adapter that utilizes the bevy_utils::tracing::info! macro to print system information.
not
Generates a Condition that inverses the result of passed one.
on_event
Generates a Condition-satisfying closure that returns true if there are any new events of the given type since it was last called.
random
Generates a random value using the thread-local random number generator.
resource_added
Generates a Condition-satisfying closure that returns true if the resource of the given type has been added since the condition was last checked.
resource_changed
Generates a Condition-satisfying closure that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_changed_or_removed
Generates a Condition-satisfying closure that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_equals
Generates a Condition-satisfying closure that returns true if the resource is equal to value.
resource_exists
Generates a Condition-satisfying closure that returns true if the resource exists.
resource_exists_and_changed
Generates a Condition-satisfying closure that returns true if the resource of the given type has had its value changed since the condition was last checked.
resource_exists_and_equals
Generates a Condition-satisfying closure that returns true if the resource exists and is equal to value.
resource_removed
Generates a Condition-satisfying closure that returns true if the resource of the given type has been removed since the condition was last checked.
run_once
Generates a Condition-satisfying closure that returns true if the first time the condition is run and false every time after
state_changed
Generates a Condition-satisfying closure that returns true if the state machine changed state.
state_exists
Generates a Condition-satisfying closure that returns true if the state machine exists.
state_exists_and_equals
Generates a Condition-satisfying closure that returns true if the state machine exists and is currently in state.
unwrap
System adapter that unwraps the Ok variant of a Result. This is useful for fallible systems that should panic in the case of an error.
warn
System adapter that utilizes the bevy_utils::tracing::warn! macro to print the output of a system.

Type Aliases§

BoxedSystem
A convenience type alias for a boxed System trait object.
ExclusiveSystemParamItem
PipeSystem
A System created by piping the output of the first system into the input of the second.
SystemParamItem
Shorthand way of accessing the associated type SystemParam::Item for a given SystemParam.

Attribute Macros§

__wasm_bindgen_class_marker
bevy_main
nesbox_bevy
reflect_trait
A macro that automatically generates type data for traits, which their implementors can then register.
wasm_bindgen
A list of all the attributes can be found here: https://rustwasm.github.io/docs/wasm-bindgen/reference/attributes/index.html

Derive Macros§

Bundle
Component
Deref
Implements Deref for single-item structs. This is especially useful when utilizing the newtype pattern.
DerefMut
Implements DerefMut for single-item structs. This is especially useful when utilizing the newtype pattern.
DynamicPlugin
Generates a dynamic plugin entry point function for the given Plugin type.
FromReflect
Derives the FromReflect trait.
Reflect
The main derive macro used by bevy_reflect for deriving its Reflect trait.
Resource
States
SystemParam
Implement SystemParam to use a struct as a parameter in a system
SystemSet
Derive macro generating an impl of the trait SystemSet.