mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Fixed several missing links in docs. (#8117)
Links in the api docs are nice. I noticed that there were several places where structs / functions and other things were referenced in the docs, but weren't linked. I added the links where possible / logical. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: François <mockersf@gmail.com>
This commit is contained in:
parent
3f6367d584
commit
abf12f3b3b
55 changed files with 132 additions and 114 deletions
|
@ -315,7 +315,7 @@ fn find_bone(
|
|||
Some(current_entity)
|
||||
}
|
||||
|
||||
/// Verify that there are no ancestors of a given entity that have an `AnimationPlayer`.
|
||||
/// Verify that there are no ancestors of a given entity that have an [`AnimationPlayer`].
|
||||
fn verify_no_ancestor_player(
|
||||
player_parent: Option<&Parent>,
|
||||
parents: &Query<(Option<With<AnimationPlayer>>, Option<&Parent>)>,
|
||||
|
|
|
@ -160,7 +160,7 @@ impl SubApp {
|
|||
}
|
||||
}
|
||||
|
||||
/// Runs the `SubApp`'s default schedule.
|
||||
/// Runs the [`SubApp`]'s default schedule.
|
||||
pub fn run(&mut self) {
|
||||
self.app.world.run_schedule(&*self.app.main_schedule_label);
|
||||
self.app.world.clear_trackers();
|
||||
|
@ -672,7 +672,7 @@ impl App {
|
|||
}
|
||||
}
|
||||
|
||||
/// Boxed variant of `add_plugin`, can be used from a [`PluginGroup`]
|
||||
/// Boxed variant of [`add_plugin`](App::add_plugin) that can be used from a [`PluginGroup`]
|
||||
pub(crate) fn add_boxed_plugin(
|
||||
&mut self,
|
||||
plugin: Box<dyn Plugin>,
|
||||
|
|
|
@ -14,7 +14,7 @@ use parking_lot::{Mutex, RwLock};
|
|||
use std::{path::Path, sync::Arc};
|
||||
use thiserror::Error;
|
||||
|
||||
/// Errors that occur while loading assets with an `AssetServer`.
|
||||
/// Errors that occur while loading assets with an [`AssetServer`].
|
||||
#[derive(Error, Debug)]
|
||||
pub enum AssetServerError {
|
||||
/// Asset folder is not a directory.
|
||||
|
|
|
@ -276,7 +276,7 @@ pub trait AddAsset {
|
|||
where
|
||||
T: Asset;
|
||||
|
||||
/// Registers the asset type `T` using `[App::register]`,
|
||||
/// Registers the asset type `T` using [`App::register_type`],
|
||||
/// and adds [`ReflectAsset`] type data to `T` and [`ReflectHandle`] type data to [`Handle<T>`] in the type registry.
|
||||
///
|
||||
/// This enables reflection code to access assets. For detailed information, see the docs on [`ReflectAsset`] and [`ReflectHandle`].
|
||||
|
@ -296,7 +296,7 @@ pub trait AddAsset {
|
|||
|
||||
/// Adds an asset loader `T` using default values.
|
||||
///
|
||||
/// The default values may come from the `World` or from `T::default()`.
|
||||
/// The default values may come from the [`World`] or from `T::default()`.
|
||||
fn init_asset_loader<T>(&mut self) -> &mut Self
|
||||
where
|
||||
T: AssetLoader + FromWorld;
|
||||
|
@ -306,7 +306,7 @@ pub trait AddAsset {
|
|||
/// Internal assets (e.g. shaders) are bundled directly into the app and can't be hot reloaded
|
||||
/// using the conventional API. See `DebugAssetServerPlugin`.
|
||||
///
|
||||
/// The default values may come from the `World` or from `T::default()`.
|
||||
/// The default values may come from the [`World`] or from `T::default()`.
|
||||
fn init_debug_asset_loader<T>(&mut self) -> &mut Self
|
||||
where
|
||||
T: AssetLoader + FromWorld;
|
||||
|
@ -407,7 +407,7 @@ impl AddAsset for App {
|
|||
/// Loads an internal asset.
|
||||
///
|
||||
/// Internal assets (e.g. shaders) are bundled directly into the app and can't be hot reloaded
|
||||
/// using the conventional API. See `DebugAssetServerPlugin`.
|
||||
/// using the conventional API. See [`DebugAssetServerPlugin`](crate::debug_asset_server::DebugAssetServerPlugin).
|
||||
#[cfg(feature = "debug_asset_server")]
|
||||
#[macro_export]
|
||||
macro_rules! load_internal_asset {
|
||||
|
|
|
@ -11,9 +11,9 @@ use std::{
|
|||
///
|
||||
/// Implementation details:
|
||||
///
|
||||
/// - `load_path` uses the [AssetManager] to load files.
|
||||
/// - `read_directory` always returns an empty iterator.
|
||||
/// - `get_metadata` will probably return an error.
|
||||
/// - [`load_path`](AssetIo::load_path) uses the [`AssetManager`] to load files.
|
||||
/// - [`read_directory`](AssetIo::read_directory) always returns an empty iterator.
|
||||
/// - [`get_metadata`](AssetIo::get_metadata) will probably return an error.
|
||||
/// - Watching for changes is not supported. The watcher methods will do nothing.
|
||||
///
|
||||
/// [AssetManager]: https://developer.android.com/reference/android/content/res/AssetManager
|
||||
|
|
|
@ -82,7 +82,7 @@ impl FileAssetIo {
|
|||
|
||||
/// Returns the root directory where assets are loaded from.
|
||||
///
|
||||
/// See `get_base_path`.
|
||||
/// See [`get_base_path`](FileAssetIo::get_base_path).
|
||||
pub fn root_path(&self) -> &PathBuf {
|
||||
&self.root_path
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ pub trait AssetIo: Downcast + Send + Sync + 'static {
|
|||
|
||||
/// Tells the asset I/O to watch for changes recursively at the provided path.
|
||||
///
|
||||
/// No-op if `watch_for_changes` hasn't been called yet.
|
||||
/// No-op if [`watch_for_changes`](AssetIo::watch_for_changes) hasn't been called yet.
|
||||
/// Otherwise triggers a reload each time `to_watch` changes.
|
||||
/// In most cases the asset found at the watched path should be changed,
|
||||
/// but when an asset depends on data at another path, the asset's path
|
||||
|
|
|
@ -80,7 +80,7 @@ impl Default for AssetPlugin {
|
|||
}
|
||||
|
||||
impl AssetPlugin {
|
||||
/// Creates an instance of the platform's default `AssetIo`.
|
||||
/// Creates an instance of the platform's default [`AssetIo`].
|
||||
///
|
||||
/// This is useful when providing a custom `AssetIo` instance that needs to
|
||||
/// delegate to the default `AssetIo` for the platform.
|
||||
|
|
|
@ -7,7 +7,8 @@ use crate::{Asset, Assets, Handle, HandleId, HandleUntyped};
|
|||
|
||||
/// Type data for the [`TypeRegistry`](bevy_reflect::TypeRegistry) used to operate on reflected [`Asset`]s.
|
||||
///
|
||||
/// This type provides similar methods to [`Assets<T>`] like `get`, `add` and `remove`, but can be used in situations where you don't know which asset type `T` you want
|
||||
/// This type provides similar methods to [`Assets<T>`] like [`get`](ReflectAsset::get),
|
||||
/// [`add`](ReflectAsset::add) and [`remove`](ReflectAsset::remove), but can be used in situations where you don't know which asset type `T` you want
|
||||
/// until runtime.
|
||||
///
|
||||
/// [`ReflectAsset`] can be obtained via [`TypeRegistration::data`](bevy_reflect::TypeRegistration::data) if the asset was registered using [`register_asset_reflect`](crate::AddAsset::register_asset_reflect).
|
||||
|
|
|
@ -34,7 +34,7 @@ use std::path::PathBuf;
|
|||
#[cfg(not(target_arch = "wasm32"))]
|
||||
use bevy_tasks::tick_global_task_pools_on_main_thread;
|
||||
|
||||
/// Registration of default types to the `TypeRegistry` resource.
|
||||
/// Registration of default types to the [`TypeRegistry`](bevy_reflect::TypeRegistry) resource.
|
||||
#[derive(Default)]
|
||||
pub struct TypeRegistrationPlugin;
|
||||
|
||||
|
@ -99,7 +99,8 @@ fn register_math_types(app: &mut App) {
|
|||
.register_type::<bevy_math::Rect>();
|
||||
}
|
||||
|
||||
/// Setup of default task pools: `AsyncComputeTaskPool`, `ComputeTaskPool`, `IoTaskPool`.
|
||||
/// Setup of default task pools: [`AsyncComputeTaskPool`](bevy_tasks::AsyncComputeTaskPool),
|
||||
/// [`ComputeTaskPool`](bevy_tasks::ComputeTaskPool), [`IoTaskPool`](bevy_tasks::IoTaskPool).
|
||||
#[derive(Default)]
|
||||
pub struct TaskPoolPlugin {
|
||||
/// Options for the [`TaskPool`](bevy_tasks::TaskPool) created at application start.
|
||||
|
|
|
@ -61,10 +61,10 @@ pub struct MotionVectorPrepass;
|
|||
#[derive(Component)]
|
||||
pub struct ViewPrepassTextures {
|
||||
/// The depth texture generated by the prepass.
|
||||
/// Exists only if [`DepthPrepass`] is added to the `ViewTarget`
|
||||
/// Exists only if [`DepthPrepass`] is added to the [`ViewTarget`](bevy_render::view::ViewTarget)
|
||||
pub depth: Option<CachedTexture>,
|
||||
/// The normals texture generated by the prepass.
|
||||
/// Exists only if [`NormalPrepass`] is added to the `ViewTarget`
|
||||
/// Exists only if [`NormalPrepass`] is added to the [`ViewTarget`](bevy_render::view::ViewTarget)
|
||||
pub normal: Option<CachedTexture>,
|
||||
/// The motion vectors texture generated by the prepass.
|
||||
/// Exists only if [`MotionVectorPrepass`] is added to the `ViewTarget`
|
||||
|
|
|
@ -148,7 +148,7 @@ impl Entity {
|
|||
/// // ... replace the entities with valid ones.
|
||||
/// ```
|
||||
///
|
||||
/// Deriving `Reflect` for a component that has an `Entity` field:
|
||||
/// Deriving [`Reflect`](bevy_reflect::Reflect) for a component that has an `Entity` field:
|
||||
///
|
||||
/// ```no_run
|
||||
/// # use bevy_ecs::{prelude::*, component::*};
|
||||
|
@ -301,15 +301,15 @@ pub struct Entities {
|
|||
/// that have been freed or are in the process of being allocated:
|
||||
///
|
||||
/// - The `freelist` IDs, previously freed by `free()`. These IDs are available to any of
|
||||
/// `alloc()`, `reserve_entity()` or `reserve_entities()`. Allocation will always prefer
|
||||
/// [`alloc`], [`reserve_entity`] or [`reserve_entities`]. Allocation will always prefer
|
||||
/// these over brand new IDs.
|
||||
///
|
||||
/// - The `reserved` list of IDs that were once in the freelist, but got reserved by
|
||||
/// `reserve_entities` or `reserve_entity()`. They are now waiting for `flush()` to make them
|
||||
/// [`reserve_entities`] or [`reserve_entity`]. They are now waiting for [`flush`] to make them
|
||||
/// fully allocated.
|
||||
///
|
||||
/// - The count of new IDs that do not yet exist in `self.meta`, but which we have handed out
|
||||
/// and reserved. `flush()` will allocate room for them in `self.meta`.
|
||||
/// and reserved. [`flush`] will allocate room for them in `self.meta`.
|
||||
///
|
||||
/// The contents of `pending` look like this:
|
||||
///
|
||||
|
@ -331,7 +331,12 @@ pub struct Entities {
|
|||
/// This formulation allows us to reserve any number of IDs first from the freelist
|
||||
/// and then from the new IDs, using only a single atomic subtract.
|
||||
///
|
||||
/// Once `flush()` is done, `free_cursor` will equal `pending.len()`.
|
||||
/// Once [`flush`] is done, `free_cursor` will equal `pending.len()`.
|
||||
///
|
||||
/// [`alloc`]: Entities::alloc
|
||||
/// [`reserve_entity`]: Entities::reserve_entity
|
||||
/// [`reserve_entities`]: Entities::reserve_entities
|
||||
/// [`flush`]: Entities::flush
|
||||
pending: Vec<u32>,
|
||||
free_cursor: AtomicIdCursor,
|
||||
/// Stores the number of free entities for [`len`](Entities::len)
|
||||
|
@ -350,7 +355,7 @@ impl Entities {
|
|||
|
||||
/// Reserve entity IDs concurrently.
|
||||
///
|
||||
/// Storage for entity generation and location is lazily allocated by calling `flush`.
|
||||
/// Storage for entity generation and location is lazily allocated by calling [`flush`](Entities::flush).
|
||||
pub fn reserve_entities(&self, count: u32) -> ReserveEntitiesIterator {
|
||||
// Use one atomic subtract to grab a range of new IDs. The range might be
|
||||
// entirely nonnegative, meaning all IDs come from the freelist, or entirely
|
||||
|
@ -626,8 +631,8 @@ impl Entities {
|
|||
*self.free_cursor.get_mut() != self.pending.len() as IdCursor
|
||||
}
|
||||
|
||||
/// Allocates space for entities previously reserved with `reserve_entity` or
|
||||
/// `reserve_entities`, then initializes each one using the supplied function.
|
||||
/// Allocates space for entities previously reserved with [`reserve_entity`](Entities::reserve_entity) or
|
||||
/// [`reserve_entities`](Entities::reserve_entities), then initializes each one using the supplied function.
|
||||
///
|
||||
/// # Safety
|
||||
/// Flush _must_ set the entity location to the correct [`ArchetypeId`] for the given [`Entity`]
|
||||
|
|
|
@ -55,7 +55,7 @@ pub mod prelude {
|
|||
|
||||
pub use bevy_utils::all_tuples;
|
||||
|
||||
/// A specialized hashmap type with Key of `TypeId`
|
||||
/// A specialized hashmap type with Key of [`TypeId`]
|
||||
type TypeIdMap<V> = rustc_hash::FxHashMap<TypeId, V>;
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -147,7 +147,7 @@ impl<T: SparseSetIndex> Access<T> {
|
|||
|
||||
/// Returns `true` if the access and `other` can be active at the same time.
|
||||
///
|
||||
/// `Access` instances are incompatible if one can write
|
||||
/// [`Access`] instances are incompatible if one can write
|
||||
/// an element that the other can read or write.
|
||||
pub fn is_compatible(&self, other: &Access<T>) -> bool {
|
||||
// Only systems that do not write data are compatible with systems that operate on `&World`.
|
||||
|
@ -218,7 +218,7 @@ impl<T: SparseSetIndex> Access<T> {
|
|||
/// - `Query<&mut T>` read/write `T`
|
||||
/// - `Query<Option<&T>>` accesses nothing
|
||||
///
|
||||
/// See comments the `WorldQuery` impls of `AnyOf`/`Option`/`Or` for more information.
|
||||
/// See comments the [`WorldQuery`](super::WorldQuery) impls of [`AnyOf`](super::AnyOf)/`Option`/[`Or`](super::Or) for more information.
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct FilteredAccess<T: SparseSetIndex> {
|
||||
access: Access<T>,
|
||||
|
@ -438,7 +438,7 @@ impl<T: SparseSetIndex> FilteredAccessSet<T> {
|
|||
/// compatible.
|
||||
/// 2. A "fine grained" check, it kicks in when the "coarse" check fails.
|
||||
/// the two access sets might still be compatible if some of the accesses
|
||||
/// are restricted with the `With` or `Without` filters so that access is
|
||||
/// are restricted with the [`With`](super::With) or [`Without`](super::Without) filters so that access is
|
||||
/// mutually exclusive. The fine grained phase iterates over all filters in
|
||||
/// the `self` set and compares it to all the filters in the `other` set,
|
||||
/// making sure they are all mutually compatible.
|
||||
|
|
|
@ -47,7 +47,7 @@ pub enum ExecutorKind {
|
|||
/// (along with dependency information for multi-threaded execution).
|
||||
///
|
||||
/// Since the arrays are sorted in the same order, elements are referenced by their index.
|
||||
/// `FixedBitSet` is used as a smaller, more efficient substitute of `HashSet<usize>`.
|
||||
/// [`FixedBitSet`] is used as a smaller, more efficient substitute of `HashSet<usize>`.
|
||||
#[derive(Default)]
|
||||
pub struct SystemSchedule {
|
||||
pub(super) systems: Vec<BoxedSystem>,
|
||||
|
|
|
@ -56,7 +56,7 @@ impl SyncUnsafeSchedule<'_> {
|
|||
/// Per-system data used by the [`MultiThreadedExecutor`].
|
||||
// Copied here because it can't be read from the system when it's running.
|
||||
struct SystemTaskMetadata {
|
||||
/// The `ArchetypeComponentId` access of the system.
|
||||
/// The [`ArchetypeComponentId`] access of the system.
|
||||
archetype_component_access: Access<ArchetypeComponentId>,
|
||||
/// Indices of the systems that directly depend on the system.
|
||||
dependents: Vec<usize>,
|
||||
|
|
|
@ -11,7 +11,7 @@ use bevy_utils::OnDrop;
|
|||
/// A flat, type-erased data storage type
|
||||
///
|
||||
/// Used to densely store homogeneous ECS data. A blob is usually just an arbitrary block of contiguous memory without any identity, and
|
||||
/// could be used to represent any arbitrary data (i.e. string, arrays, etc). This type is an extendable and reallcatable blob, which makes
|
||||
/// could be used to represent any arbitrary data (i.e. string, arrays, etc). This type is an extendable and re-allocatable blob, which makes
|
||||
/// it a blobby Vec, a `BlobVec`.
|
||||
pub(super) struct BlobVec {
|
||||
item_layout: Layout,
|
||||
|
|
|
@ -184,7 +184,7 @@ impl<'w, 's> Commands<'w, 's> {
|
|||
/// Pushes a [`Command`] to the queue for creating a new [`Entity`] if the given one does not exists,
|
||||
/// and returns its corresponding [`EntityCommands`].
|
||||
///
|
||||
/// This method silently fails by returning `EntityCommands`
|
||||
/// This method silently fails by returning [`EntityCommands`]
|
||||
/// even if the given `Entity` cannot be spawned.
|
||||
///
|
||||
/// See [`World::get_or_spawn`] for more details.
|
||||
|
@ -345,7 +345,7 @@ impl<'w, 's> Commands<'w, 's> {
|
|||
|
||||
/// Pushes a [`Command`] to the queue for creating entities with a particular [`Bundle`] type.
|
||||
///
|
||||
/// `bundles_iter` is a type that can be converted into a `Bundle` iterator
|
||||
/// `bundles_iter` is a type that can be converted into a [`Bundle`] iterator
|
||||
/// (it can also be a collection).
|
||||
///
|
||||
/// This method is equivalent to iterating `bundles_iter`
|
||||
|
|
|
@ -489,7 +489,7 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// SAFETY: `F`'s param is `ReadOnlySystemParam`, so this system will only read from the world.
|
||||
/// SAFETY: `F`'s param is [`ReadOnlySystemParam`], so this system will only read from the world.
|
||||
unsafe impl<Marker, F> ReadOnlySystem for FunctionSystem<Marker, F>
|
||||
where
|
||||
Marker: 'static,
|
||||
|
|
|
@ -63,7 +63,7 @@ pub struct World {
|
|||
pub(crate) storages: Storages,
|
||||
pub(crate) bundles: Bundles,
|
||||
pub(crate) removed_components: RemovedComponentEvents,
|
||||
/// Access cache used by [WorldCell]. Is only accessed in the `Drop` impl of `WorldCell`.
|
||||
/// Access cache used by [`WorldCell`]. Is only accessed in the `Drop` impl of `WorldCell`.
|
||||
pub(crate) archetype_component_access: ArchetypeComponentAccess,
|
||||
pub(crate) change_tick: AtomicU32,
|
||||
pub(crate) last_change_tick: Tick,
|
||||
|
|
|
@ -45,7 +45,7 @@ impl<T> Default for ReportHierarchyIssue<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// System to print a warning for each `Entity` with a `T` component
|
||||
/// System to print a warning for each [`Entity`] with a `T` component
|
||||
/// which parent hasn't a `T` component.
|
||||
///
|
||||
/// Hierarchy propagations are top-down, and limited only to entities
|
||||
|
|
|
@ -90,7 +90,7 @@ impl Gamepad {
|
|||
}
|
||||
}
|
||||
|
||||
/// Metadata associated with a `Gamepad`.
|
||||
/// Metadata associated with a [`Gamepad`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Reflect, FromReflect)]
|
||||
#[reflect(Debug, PartialEq)]
|
||||
#[cfg_attr(
|
||||
|
@ -629,9 +629,9 @@ impl AxisSettings {
|
|||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an `AxisSettingsError` if any restrictions on the zone values are not met.
|
||||
/// If the zone restrictions are met, but the ``threshold`` value restrictions are not met,
|
||||
/// returns `AxisSettingsError::Threshold`.
|
||||
/// Returns an [`AxisSettingsError`] if any restrictions on the zone values are not met.
|
||||
/// If the zone restrictions are met, but the `threshold` value restrictions are not met,
|
||||
/// returns [`AxisSettingsError::Threshold`].
|
||||
pub fn new(
|
||||
livezone_lowerbound: f32,
|
||||
deadzone_lowerbound: f32,
|
||||
|
@ -875,7 +875,7 @@ impl AxisSettings {
|
|||
}
|
||||
|
||||
/// Determines whether the change from `old_value` to `new_value` should
|
||||
/// be registered as a change, according to the `AxisSettings`.
|
||||
/// be registered as a change, according to the [`AxisSettings`].
|
||||
fn should_register_change(&self, new_value: f32, old_value: Option<f32>) -> bool {
|
||||
if old_value.is_none() {
|
||||
return true;
|
||||
|
@ -963,7 +963,7 @@ impl ButtonAxisSettings {
|
|||
f32::abs(new_value - old_value.unwrap()) > self.threshold
|
||||
}
|
||||
|
||||
/// Filters the `new_value` based on the `old_value`, according to the `ButtonAxisSettings`.
|
||||
/// Filters the `new_value` based on the `old_value`, according to the [`ButtonAxisSettings`].
|
||||
///
|
||||
/// Returns the clamped `new_value`, according to the [`ButtonAxisSettings`], if the change
|
||||
/// exceeds the settings threshold, and `None` otherwise.
|
||||
|
@ -1116,7 +1116,7 @@ impl GamepadButtonChangedEvent {
|
|||
}
|
||||
}
|
||||
|
||||
/// Uses [`GamepadAxisChangedEvent`]s to update the relevant `Input` and `Axis` values.
|
||||
/// Uses [`GamepadAxisChangedEvent`]s to update the relevant [`Input`] and [`Axis`] values.
|
||||
pub fn gamepad_axis_event_system(
|
||||
mut gamepad_axis: ResMut<Axis<GamepadAxis>>,
|
||||
mut axis_events: EventReader<GamepadAxisChangedEvent>,
|
||||
|
@ -1127,7 +1127,7 @@ pub fn gamepad_axis_event_system(
|
|||
}
|
||||
}
|
||||
|
||||
/// Uses [`GamepadButtonChangedEvent`]s to update the relevant `Input` and `Axis` values.
|
||||
/// Uses [`GamepadButtonChangedEvent`]s to update the relevant [`Input`] and [`Axis`] values.
|
||||
pub fn gamepad_button_event_system(
|
||||
mut button_events: EventReader<GamepadButtonChangedEvent>,
|
||||
mut button_input: ResMut<Input<GamepadButton>>,
|
||||
|
|
|
@ -148,7 +148,7 @@ impl<'a, A: IsAligned> Ptr<'a, A> {
|
|||
/// - If the `A` type parameter is [`Aligned`] then `inner` must be sufficiently aligned for the pointee type.
|
||||
/// - `inner` must have correct provenance to allow reads of the pointee type.
|
||||
/// - The lifetime `'a` must be constrained such that this [`Ptr`] will stay valid and nothing
|
||||
/// can mutate the pointee while this [`Ptr`] is live except through an `UnsafeCell`.
|
||||
/// can mutate the pointee while this [`Ptr`] is live except through an [`UnsafeCell`].
|
||||
#[inline]
|
||||
pub unsafe fn new(inner: NonNull<u8>) -> Self {
|
||||
Self(inner, PhantomData)
|
||||
|
@ -167,7 +167,7 @@ impl<'a, A: IsAligned> Ptr<'a, A> {
|
|||
///
|
||||
/// # Safety
|
||||
/// - `T` must be the erased pointee type for this [`Ptr`].
|
||||
/// - If the type parameter `A` is `Unaligned` then this pointer must be sufficiently aligned
|
||||
/// - If the type parameter `A` is [`Unaligned`] then this pointer must be sufficiently aligned
|
||||
/// for the pointee type `T`.
|
||||
#[inline]
|
||||
pub unsafe fn deref<T>(self) -> &'a T {
|
||||
|
@ -290,7 +290,7 @@ impl<'a, A: IsAligned> OwningPtr<'a, A> {
|
|||
///
|
||||
/// # Safety
|
||||
/// - `T` must be the erased pointee type for this [`OwningPtr`].
|
||||
/// - If the type parameter `A` is `Unaligned` then this pointer must be sufficiently aligned
|
||||
/// - If the type parameter `A` is [`Unaligned`] then this pointer must be sufficiently aligned
|
||||
/// for the pointee type `T`.
|
||||
#[inline]
|
||||
pub unsafe fn read<T>(self) -> T {
|
||||
|
@ -301,7 +301,7 @@ impl<'a, A: IsAligned> OwningPtr<'a, A> {
|
|||
///
|
||||
/// # Safety
|
||||
/// - `T` must be the erased pointee type for this [`OwningPtr`].
|
||||
/// - If the type parameter `A` is `Unaligned` then this pointer must be sufficiently aligned
|
||||
/// - If the type parameter `A` is [`Unaligned`] then this pointer must be sufficiently aligned
|
||||
/// for the pointee type `T`.
|
||||
#[inline]
|
||||
pub unsafe fn drop_as<T>(self) {
|
||||
|
|
|
@ -32,7 +32,7 @@ pub(crate) struct ResultSifter<T> {
|
|||
errors: Option<syn::Error>,
|
||||
}
|
||||
|
||||
/// Returns a `Member` made of `ident` or `index` if `ident` is None.
|
||||
/// Returns a [`Member`] made of `ident` or `index` if `ident` is None.
|
||||
///
|
||||
/// Rust struct syntax allows for `Struct { foo: "string" }` with explicitly
|
||||
/// named fields. It allows the `Struct { 0: "string" }` syntax when the struct
|
||||
|
|
|
@ -131,7 +131,7 @@ impl TypeRegistry {
|
|||
///
|
||||
/// Most of the time [`TypeRegistry::register`] can be used instead to register a type you derived [`Reflect`] for.
|
||||
/// However, in cases where you want to add a piece of type data that was not included in the list of `#[reflect(...)]` type data in the derive,
|
||||
/// or where the type is generic and cannot register e.g. `ReflectSerialize` unconditionally without knowing the specific type parameters,
|
||||
/// or where the type is generic and cannot register e.g. [`ReflectSerialize`] unconditionally without knowing the specific type parameters,
|
||||
/// this method can be used to insert additional type data.
|
||||
///
|
||||
/// # Example
|
||||
|
@ -220,7 +220,7 @@ impl TypeRegistry {
|
|||
.and_then(|id| self.registrations.get_mut(id))
|
||||
}
|
||||
|
||||
/// Returns a reference to the [`TypeData`] of type `T` associated with the given `TypeId`.
|
||||
/// Returns a reference to the [`TypeData`] of type `T` associated with the given [`TypeId`].
|
||||
///
|
||||
/// The returned value may be used to downcast [`Reflect`] trait objects to
|
||||
/// trait objects of the trait used to generate `T`, provided that the
|
||||
|
@ -234,7 +234,7 @@ impl TypeRegistry {
|
|||
.and_then(|registration| registration.data::<T>())
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the [`TypeData`] of type `T` associated with the given `TypeId`.
|
||||
/// Returns a mutable reference to the [`TypeData`] of type `T` associated with the given [`TypeId`].
|
||||
///
|
||||
/// If the specified type has not been registered, or if `T` is not present
|
||||
/// in its type registration, returns `None`.
|
||||
|
@ -243,7 +243,7 @@ impl TypeRegistry {
|
|||
.and_then(|registration| registration.data_mut::<T>())
|
||||
}
|
||||
|
||||
/// Returns the [`TypeInfo`] associated with the given `TypeId`.
|
||||
/// Returns the [`TypeInfo`] associated with the given [`TypeId`].
|
||||
///
|
||||
/// If the specified type has not been registered, returns `None`.
|
||||
pub fn get_type_info(&self, type_id: TypeId) -> Option<&'static TypeInfo> {
|
||||
|
|
|
@ -469,7 +469,7 @@ struct UniformBindingMeta {
|
|||
/// Represents the arguments for any general binding attribute.
|
||||
///
|
||||
/// If parsed, represents an attribute
|
||||
/// like `#[foo(LitInt, ...)]` where the rest is optional `NestedMeta`.
|
||||
/// like `#[foo(LitInt, ...)]` where the rest is optional [`NestedMeta`].
|
||||
enum BindingMeta {
|
||||
IndexOnly(LitInt),
|
||||
IndexWithOptions(BindingIndexOptions),
|
||||
|
|
|
@ -79,27 +79,27 @@ pub enum RenderSet {
|
|||
ExtractCommands,
|
||||
/// Prepare render resources from the extracted data for the GPU.
|
||||
Prepare,
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after `Prepare`.
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after [`Prepare`](RenderSet::Prepare).
|
||||
PrepareFlush,
|
||||
/// Create [`BindGroups`](crate::render_resource::BindGroup) that depend on
|
||||
/// Create [`BindGroups`](render_resource::BindGroup) that depend on
|
||||
/// [`Prepare`](RenderSet::Prepare) data and queue up draw calls to run during the
|
||||
/// [`Render`](RenderSet::Render) step.
|
||||
Queue,
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after `Queue`.
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after [`Queue`](RenderSet::Queue).
|
||||
QueueFlush,
|
||||
// TODO: This could probably be moved in favor of a system ordering abstraction in Render or Queue
|
||||
/// Sort the [`RenderPhases`](crate::render_phase::RenderPhase) here.
|
||||
/// Sort the [`RenderPhases`](render_phase::RenderPhase) here.
|
||||
PhaseSort,
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after `PhaseSort`.
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after [`PhaseSort`](RenderSet::PhaseSort).
|
||||
PhaseSortFlush,
|
||||
/// Actual rendering happens here.
|
||||
/// In most cases, only the render backend should insert resources here.
|
||||
Render,
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after `Render`.
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after [`Render`](RenderSet::Render).
|
||||
RenderFlush,
|
||||
/// Cleanup render resources here.
|
||||
Cleanup,
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after `Cleanup`.
|
||||
/// The copy of [`apply_system_buffers`] that runs immediately after [`Cleanup`](RenderSet::Cleanup).
|
||||
CleanupFlush,
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,16 @@ use super::NodeId;
|
|||
/// They are used to describe the ordering (which node has to run first)
|
||||
/// and may be of two kinds: [`NodeEdge`](Self::NodeEdge) and [`SlotEdge`](Self::SlotEdge).
|
||||
///
|
||||
/// Edges are added via the `render_graph::add_node_edge(output_node, input_node)` and the
|
||||
/// `render_graph::add_slot_edge(output_node, output_slot, input_node, input_slot)` methods.
|
||||
/// Edges are added via the [`RenderGraph::add_node_edge`] and the
|
||||
/// [`RenderGraph::add_slot_edge`] methods.
|
||||
///
|
||||
/// The former simply states that the `output_node` has to be run before the `input_node`,
|
||||
/// while the later connects an output slot of the `output_node`
|
||||
/// with an input slot of the `input_node` to pass additional data along.
|
||||
/// For more information see [`SlotType`](super::SlotType).
|
||||
///
|
||||
/// [`RenderGraph::add_node_edge`]: crate::render_graph::RenderGraph::add_node_edge
|
||||
/// [`RenderGraph::add_slot_edge`]: crate::render_graph::RenderGraph::add_slot_edge
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum Edge {
|
||||
/// An edge describing to ordering of both nodes (`output_node` before `input_node`)
|
||||
|
|
|
@ -18,7 +18,7 @@ use std::{any::TypeId, fmt::Debug, hash::Hash};
|
|||
/// [`RenderCommand`]s. For more details and an example see the [`RenderCommand`] documentation.
|
||||
pub trait Draw<P: PhaseItem>: Send + Sync + 'static {
|
||||
/// Prepares the draw function to be used. This is called once and only once before the phase
|
||||
/// begins. There may be zero or more `draw` calls following a call to this function.
|
||||
/// begins. There may be zero or more [`draw`](Draw::draw) calls following a call to this function.
|
||||
/// Implementing this is optional.
|
||||
#[allow(unused_variables)]
|
||||
fn prepare(&mut self, world: &'_ World) {}
|
||||
|
@ -249,7 +249,7 @@ where
|
|||
C::Param: ReadOnlySystemParam,
|
||||
{
|
||||
/// Prepares the render command to be used. This is called once and only once before the phase
|
||||
/// begins. There may be zero or more `draw` calls following a call to this function.
|
||||
/// begins. There may be zero or more [`draw`](RenderCommandState::draw) calls following a call to this function.
|
||||
fn prepare(&mut self, world: &'_ World) {
|
||||
self.state.update_archetypes(world);
|
||||
self.view.update_archetypes(world);
|
||||
|
|
|
@ -107,7 +107,7 @@ pub struct RenderAdapter(pub Arc<Adapter>);
|
|||
#[derive(Resource, Deref, DerefMut)]
|
||||
pub struct RenderInstance(pub Instance);
|
||||
|
||||
/// The `AdapterInfo` of the adapter in use by the renderer.
|
||||
/// The [`AdapterInfo`] of the adapter in use by the renderer.
|
||||
#[derive(Resource, Clone, Deref, DerefMut)]
|
||||
pub struct RenderAdapterInfo(pub AdapterInfo);
|
||||
|
||||
|
|
|
@ -128,19 +128,19 @@ pub enum ImageSampler {
|
|||
}
|
||||
|
||||
impl ImageSampler {
|
||||
/// Returns an image sampler with `Linear` min and mag filters
|
||||
/// Returns an image sampler with [`Linear`](crate::render_resource::FilterMode::Linear) min and mag filters
|
||||
#[inline]
|
||||
pub fn linear() -> ImageSampler {
|
||||
ImageSampler::Descriptor(Self::linear_descriptor())
|
||||
}
|
||||
|
||||
/// Returns an image sampler with `nearest` min and mag filters
|
||||
/// Returns an image sampler with [`Nearest`](crate::render_resource::FilterMode::Nearest) min and mag filters
|
||||
#[inline]
|
||||
pub fn nearest() -> ImageSampler {
|
||||
ImageSampler::Descriptor(Self::nearest_descriptor())
|
||||
}
|
||||
|
||||
/// Returns a sampler descriptor with `Linear` min and mag filters
|
||||
/// Returns a sampler descriptor with [`Linear`](crate::render_resource::FilterMode::Linear) min and mag filters
|
||||
#[inline]
|
||||
pub fn linear_descriptor() -> wgpu::SamplerDescriptor<'static> {
|
||||
wgpu::SamplerDescriptor {
|
||||
|
@ -151,7 +151,7 @@ impl ImageSampler {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a sampler descriptor with `Nearest` min and mag filters
|
||||
/// Returns a sampler descriptor with [`Nearest`](crate::render_resource::FilterMode::Nearest) min and mag filters
|
||||
#[inline]
|
||||
pub fn nearest_descriptor() -> wgpu::SamplerDescriptor<'static> {
|
||||
wgpu::SamplerDescriptor {
|
||||
|
|
|
@ -25,7 +25,7 @@ use crate::{
|
|||
/// User indication of whether an entity is visible. Propagates down the entity hierarchy.
|
||||
///
|
||||
/// If an entity is hidden in this way, all [`Children`] (and all of their children and so on) who
|
||||
/// are set to `Inherited` will also be hidden.
|
||||
/// are set to [`Inherited`](Self::Inherited) will also be hidden.
|
||||
///
|
||||
/// This is done by the `visibility_propagate_system` which uses the entity hierarchy and
|
||||
/// `Visibility` to set the values of each entity's [`ComputedVisibility`] component.
|
||||
|
|
|
@ -36,10 +36,10 @@ pub struct DynamicScene {
|
|||
|
||||
/// A reflection-powered serializable representation of an entity and its components.
|
||||
pub struct DynamicEntity {
|
||||
/// The transiently unique identifier of a corresponding `Entity`.
|
||||
/// The transiently unique identifier of a corresponding [`Entity`](bevy_ecs::entity::Entity).
|
||||
pub entity: u32,
|
||||
/// A vector of boxed components that belong to the given entity and
|
||||
/// implement the `Reflect` trait.
|
||||
/// implement the [`Reflect`] trait.
|
||||
pub components: Vec<Box<dyn Reflect>>,
|
||||
}
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ pub enum Collision {
|
|||
// TODO: ideally we can remove this once bevy gets a physics system
|
||||
/// Axis-aligned bounding box collision with "side" detection
|
||||
/// * `a_pos` and `b_pos` are the center positions of the rectangles, typically obtained by
|
||||
/// extracting the `translation` field from a `Transform` component
|
||||
/// extracting the `translation` field from a [`Transform`](bevy_transform::components::Transform) component
|
||||
/// * `a_size` and `b_size` are the dimensions (width and height) of the rectangles.
|
||||
///
|
||||
/// The return value is the side of `B` that `A` has collided with. `Left` means that
|
||||
/// `A` collided with `B`'s left side. `Top` means that `A` collided with `B`'s top side.
|
||||
/// The return value is the side of `B` that `A` has collided with. [`Collision::Left`] means that
|
||||
/// `A` collided with `B`'s left side. [`Collision::Top`] means that `A` collided with `B`'s top side.
|
||||
/// If the collision occurs on multiple sides, the side with the deepest penetration is returned.
|
||||
/// If all sides are involved, `Inside` is returned.
|
||||
/// If all sides are involved, [`Collision::Inside`] is returned.
|
||||
pub fn collide(a_pos: Vec3, a_size: Vec2, b_pos: Vec3, b_size: Vec2) -> Option<Collision> {
|
||||
let a_min = a_pos.truncate() - a_size / 2.0;
|
||||
let a_max = a_pos.truncate() + a_size / 2.0;
|
||||
|
|
|
@ -309,7 +309,7 @@ pub struct ExtractedSprite {
|
|||
pub rect: Option<Rect>,
|
||||
/// Change the on-screen size of the sprite
|
||||
pub custom_size: Option<Vec2>,
|
||||
/// Handle to the `Image` of this sprite
|
||||
/// Handle to the [`Image`] of this sprite
|
||||
/// PERF: storing a `HandleId` instead of `Handle<Image>` enables some optimizations (`ExtractedSprite` becomes `Copy` and doesn't need to be dropped)
|
||||
pub image_handle_id: HandleId,
|
||||
pub flip_x: bool,
|
||||
|
|
|
@ -572,7 +572,7 @@ impl Drop for TaskPool {
|
|||
}
|
||||
}
|
||||
|
||||
/// A `TaskPool` scope for running one or more non-`'static` futures.
|
||||
/// A [`TaskPool`] scope for running one or more non-`'static` futures.
|
||||
///
|
||||
/// For more information, see [`TaskPool::scope`].
|
||||
#[derive(Debug)]
|
||||
|
|
|
@ -29,7 +29,7 @@ use crate::{
|
|||
|
||||
/// The maximum width and height of text. The text will wrap according to the specified size.
|
||||
/// Characters out of the bounds after wrapping will be truncated. Text is aligned according to the
|
||||
/// specified `TextAlignment`.
|
||||
/// specified [`TextAlignment`](crate::text::TextAlignment).
|
||||
///
|
||||
/// Note: only characters that are completely out of the bounds will be truncated, so this is not a
|
||||
/// reliable limit if it is necessary to contain the text strictly in the bounds. Currently this
|
||||
|
|
|
@ -45,7 +45,7 @@ impl Command for AddChildInPlace {
|
|||
/// You most likely want to use [`BuildChildrenTransformExt::remove_parent_in_place`]
|
||||
/// method on [`EntityCommands`] instead.
|
||||
pub struct RemoveParentInPlace {
|
||||
/// `Entity` whose parent must be removed.
|
||||
/// [`Entity`] whose parent must be removed.
|
||||
pub child: Entity,
|
||||
}
|
||||
impl Command for RemoveParentInPlace {
|
||||
|
|
|
@ -111,9 +111,9 @@ impl GlobalTransform {
|
|||
/// Returns the [`Transform`] `self` would have if it was a child of an entity
|
||||
/// with the `parent` [`GlobalTransform`].
|
||||
///
|
||||
/// This is useful if you want to "reparent" an `Entity`. Say you have an entity
|
||||
/// `e1` that you want to turn into a child of `e2`, but you want `e1` to keep the
|
||||
/// same global transform, even after re-parenting. You would use:
|
||||
/// This is useful if you want to "reparent" an [`Entity`](bevy_ecs::entity::Entity).
|
||||
/// Say you have an entity `e1` that you want to turn into a child of `e2`,
|
||||
/// but you want `e1` to keep the same global transform, even after re-parenting. You would use:
|
||||
///
|
||||
/// ```rust
|
||||
/// # use bevy_transform::prelude::{GlobalTransform, Transform};
|
||||
|
|
|
@ -15,7 +15,7 @@ use bevy_render::extract_component::ExtractComponent;
|
|||
pub struct UiCameraConfig {
|
||||
/// Whether to output UI to this camera view.
|
||||
///
|
||||
/// When a `Camera` doesn't have the [`UiCameraConfig`] component,
|
||||
/// When a [`Camera`] doesn't have the [`UiCameraConfig`] component,
|
||||
/// it will display the UI by default.
|
||||
pub show_ui: bool,
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ pub struct NodeBundle {
|
|||
/// The transform of the node
|
||||
///
|
||||
/// This field is automatically managed by the UI layout system.
|
||||
/// To alter the position of the `nodebundle`, use the properties of the [`Style`] component.
|
||||
/// To alter the position of the `NodeBundle`, use the properties of the [`Style`] component.
|
||||
pub transform: Transform,
|
||||
/// The global transform of the node
|
||||
///
|
||||
|
|
|
@ -29,13 +29,13 @@ impl Node {
|
|||
self.calculated_size
|
||||
}
|
||||
|
||||
/// Returns the logical pixel coordinates of the UI node, based on its `GlobalTransform`.
|
||||
/// Returns the logical pixel coordinates of the UI node, based on its [`GlobalTransform`].
|
||||
#[inline]
|
||||
pub fn logical_rect(&self, transform: &GlobalTransform) -> Rect {
|
||||
Rect::from_center_size(transform.translation().truncate(), self.size())
|
||||
}
|
||||
|
||||
/// Returns the physical pixel coordinates of the UI node, based on its `GlobalTransform` and the scale factor.
|
||||
/// Returns the physical pixel coordinates of the UI node, based on its [`GlobalTransform`] and the scale factor.
|
||||
#[inline]
|
||||
pub fn physical_rect(&self, transform: &GlobalTransform, scale_factor: f32) -> Rect {
|
||||
let rect = self.logical_rect(transform);
|
||||
|
|
|
@ -74,7 +74,7 @@ pub struct WindowCloseRequested {
|
|||
}
|
||||
|
||||
/// An event that is sent whenever a window is closed. This will be sent when
|
||||
/// the window entity loses its `Window` component or is despawned.
|
||||
/// the window entity loses its [`Window`](crate::window::Window) component or is despawned.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Reflect, FromReflect)]
|
||||
#[reflect(Debug, PartialEq)]
|
||||
#[cfg_attr(
|
||||
|
|
|
@ -694,16 +694,23 @@ pub enum MonitorSelection {
|
|||
|
||||
/// Presentation mode for a window.
|
||||
///
|
||||
/// The presentation mode specifies when a frame is presented to the window. The `Fifo`
|
||||
/// The presentation mode specifies when a frame is presented to the window. The [`Fifo`]
|
||||
/// option corresponds to a traditional `VSync`, where the framerate is capped by the
|
||||
/// display refresh rate. Both `Immediate` and `Mailbox` are low-latency and are not
|
||||
/// display refresh rate. Both [`Immediate`] and [`Mailbox`] are low-latency and are not
|
||||
/// capped by the refresh rate, but may not be available on all platforms. Tearing
|
||||
/// may be observed with `Immediate` mode, but will not be observed with `Mailbox` or
|
||||
/// `Fifo`.
|
||||
/// may be observed with [`Immediate`] mode, but will not be observed with [`Mailbox`] or
|
||||
/// [`Fifo`].
|
||||
///
|
||||
/// `AutoVsync` or `AutoNoVsync` will gracefully fallback to `Fifo` when unavailable.
|
||||
/// [`AutoVsync`] or [`AutoNoVsync`] will gracefully fallback to [`Fifo`] when unavailable.
|
||||
///
|
||||
/// [`Immediate`] or [`Mailbox`] will panic if not supported by the platform.
|
||||
///
|
||||
/// [`Fifo`]: PresentMode::Fifo
|
||||
/// [`Immediate`]: PresentMode::Immediate
|
||||
/// [`Mailbox`]: PresentMode::Mailbox
|
||||
/// [`AutoVsync`]: PresentMode::AutoVsync
|
||||
/// [`AutoNoVsync`]: PresentMode::AutoNoVsync
|
||||
///
|
||||
/// `Immediate` or `Mailbox` will panic if not supported by the platform.
|
||||
#[repr(C)]
|
||||
#[derive(Default, Copy, Clone, Debug, PartialEq, Eq, Hash, Reflect, FromReflect)]
|
||||
#[cfg_attr(
|
||||
|
@ -753,8 +760,8 @@ pub enum PresentMode {
|
|||
)]
|
||||
#[reflect(Debug, PartialEq, Hash)]
|
||||
pub enum CompositeAlphaMode {
|
||||
/// Chooses either `Opaque` or `Inherit` automatically, depending on the
|
||||
/// `alpha_mode` that the current surface can support.
|
||||
/// Chooses either [`Opaque`](CompositeAlphaMode::Opaque) or [`Inherit`](CompositeAlphaMode::Inherit)
|
||||
/// automatically, depending on the `alpha_mode` that the current surface can support.
|
||||
#[default]
|
||||
Auto = 0,
|
||||
/// The alpha channel, if it exists, of the textures is ignored in the
|
||||
|
|
|
@ -264,7 +264,8 @@ struct WinitPersistentState {
|
|||
low_power_event: bool,
|
||||
/// Tracks whether the event loop was started this frame because of a redraw request.
|
||||
redraw_request_sent: bool,
|
||||
/// Tracks if the event loop was started this frame because of a `WaitUntil` timeout.
|
||||
/// Tracks if the event loop was started this frame because of a [`ControlFlow::WaitUntil`]
|
||||
/// timeout.
|
||||
timeout_reached: bool,
|
||||
last_update: Instant,
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ use crate::{
|
|||
get_best_videomode, get_fitting_videomode, WinitWindows,
|
||||
};
|
||||
|
||||
/// System responsible for creating new windows whenever a `Window` component is added
|
||||
/// System responsible for creating new windows whenever a [`Window`] component is added
|
||||
/// to an entity.
|
||||
///
|
||||
/// This will default any necessary components if they are not already added.
|
||||
|
|
|
@ -51,7 +51,7 @@ impl WinitSettings {
|
|||
}
|
||||
}
|
||||
|
||||
/// Gets the configured `UpdateMode` depending on whether the window is focused or not
|
||||
/// Gets the configured [`UpdateMode`] depending on whether the window is focused or not
|
||||
pub fn update_mode(&self, focused: bool) -> &UpdateMode {
|
||||
match focused {
|
||||
true => &self.focused_mode,
|
||||
|
|
|
@ -107,10 +107,10 @@ fn setup(
|
|||
|
||||
/// Fades the alpha channel of all materials between 0 and 1 over time.
|
||||
/// Each blend mode responds differently to this:
|
||||
/// - `Opaque`: Ignores alpha channel altogether, these materials stay completely opaque.
|
||||
/// - `Mask(f32)`: Object appears when the alpha value goes above the mask's threshold, disappears
|
||||
/// - [`Opaque`](AlphaMode::Opaque): Ignores alpha channel altogether, these materials stay completely opaque.
|
||||
/// - [`Mask(f32)`](AlphaMode::Mask): Object appears when the alpha value goes above the mask's threshold, disappears
|
||||
/// when the alpha value goes back below the threshold.
|
||||
/// - `Blend`: Object fades in and out smoothly.
|
||||
/// - [`Blend`](AlphaMode::Blend): Object fades in and out smoothly.
|
||||
pub fn fade_transparency(time: Res<Time>, mut materials: ResMut<Assets<StandardMaterial>>) {
|
||||
let alpha = (time.elapsed_seconds().sin() / 2.0) + 0.5;
|
||||
for (_, material) in materials.iter_mut() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Create and play an animation defined by code that operates on the `Transform` component.
|
||||
//! Create and play an animation defined by code that operates on the [`Transform`] component.
|
||||
|
||||
use std::f32::consts::PI;
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ struct ComputeTransform(Task<Transform>);
|
|||
|
||||
/// This system generates tasks simulating computationally intensive
|
||||
/// work that potentially spans multiple frames/ticks. A separate
|
||||
/// system, `handle_tasks`, will poll the spawned tasks on subsequent
|
||||
/// system, [`handle_tasks`], will poll the spawned tasks on subsequent
|
||||
/// frames/ticks, and use the results to spawn cubes
|
||||
fn spawn_tasks(mut commands: Commands) {
|
||||
let thread_pool = AsyncComputeTaskPool::get();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Shows how to create a custom `Decodable` type by implementing a Sine wave.
|
||||
//! Shows how to create a custom [`Decodable`] type by implementing a Sine wave.
|
||||
use bevy::audio::AddAudioSource;
|
||||
use bevy::audio::AudioPlugin;
|
||||
use bevy::audio::Source;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! This example illustrates the usage of the `WorldQuery` derive macro, which allows
|
||||
//! This example illustrates the usage of the [`WorldQuery`] derive macro, which allows
|
||||
//! defining custom query and filter types.
|
||||
//!
|
||||
//! While regular tuple queries work great in most of simple scenarios, using custom queries
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! This example shows how you can know when a `Component` has been removed, so you can react to it.
|
||||
//! This example shows how you can know when a [`Component`] has been removed, so you can react to it.
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! A freecam-style camera controller plugin.
|
||||
//! To use in your own application:
|
||||
//! - Copy the code for the `CameraControllerPlugin` and add the plugin to your App.
|
||||
//! - Attach the `CameraController` component to an entity with a `Camera3dBundle`.
|
||||
//! - Copy the code for the [`CameraControllerPlugin`] and add the plugin to your App.
|
||||
//! - Attach the [`CameraController`] component to an entity with a [`Camera3dBundle`].
|
||||
|
||||
use bevy::window::CursorGrabMode;
|
||||
use bevy::{input::mouse::MouseMotion, prelude::*};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Showcases the `RelativeCursorPosition` component, used to check the position of the cursor relative to a UI node.
|
||||
//! Showcases the [`RelativeCursorPosition`] component, used to check the position of the cursor relative to a UI node.
|
||||
|
||||
use bevy::{prelude::*, ui::RelativeCursorPosition, winit::WinitSettings};
|
||||
|
||||
|
|
Loading…
Reference in a new issue