1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
//! # `bevy_parallaxation2d`
//! Crate providing simple 2D parallax layers in Bevy.
//!
//! ## Features
//! * **[`ParallaxPlugin`](crate::plugin::ParallaxPlugin)** - Plugin required for the parallax functionality.
//! * **[`ParallaxCamera`](crate::components::ParallaxCamera)** - Component for marking the parallax camera. **Only one camera can use parallax layers**.
//! * **[`ParallaxLayer`](crate::components::ParallaxLayer)** - Component for creating a parallax layer.
//! * **[`ParallaxFlags`](crate::flags::ParallaxFlags)** - Bit flags for defining attributes of a parallax layer.
//!
//! ## Examples
//! ```no_run
//! use bevy::prelude::*;
//!
//! // Import the `bevy_parallaxation2d` crate
//! use bevy_parallaxation2d::prelude::*;
//!
//! fn main() {
//!     App::new()
//!         .add_plugins((DefaultPlugins, ParallaxPlugin::default()))
//!         .add_systems(Startup, setup)
//!         .run();
//! }
//!
//! fn setup(mut commands: Commands) {
//!     // Spawn parallax camera
//!     commands
//!         .spawn(Camera2dBundle::default())
//!         .insert(ParallaxCamera);
//!
//!     // Spawn:
//!     // * Main background that repeats in both directions.
//!     // * Hills that will default to repeating horizontally.
//!     // * Foreground at the top of the screen.
//!     commands.spawn_batch(vec![
//!         ParallaxLayer {
//!             image: "images/main_background.png",
//!             depth: 80.0.into(),
//!             flags: ParallaxFlags::REPEAT_X_AXIS | ParallaxFlags::REPEAT_Y_AXIS,
//!             ..default()
//!         },
//!         ParallaxLayer {
//!             image: "images/hills_background.png",
//!             depth: 40.0.into(),
//!             ..default()
//!         },
//!         ParallaxLayer {
//!             image: "images/branches_foreground.png",
//!             depth: (-5.0).into(),
//!             flags: ParallaxFlags::REPEAT_X_AXIS | ParallaxFlags::OFFSET_CAMERA_TOP,
//!             ..default()
//!         },
//!     ]);
//! }
//! ```
mod components;
mod flags;
mod material;
mod plugin;
mod resources;
mod systems;
/// The `depth` module provides extra functions and options for creating and
/// managing [`Depth`] values used in parallax effects.
///
/// The recommend way to use [`Depth`] values is simply by using `.into()` on an [`f32`] as in
/// the example:
/// ```
/// # use bevy::prelude::default;
/// # use bevy_parallaxation2d::prelude::*;
/// let layer = ParallaxLayer {
///     image: "background.png",
///     depth: 1.0.into(),
///     ..default()
/// };
/// ```
pub mod depth;
/// The `prelude` module exports commonly used types to provide a convenient entry
/// point for users of the `bevy_parallaxation2d` crate. It includes plugins,
/// components, and bitflags necessary for implementing parallax effects.
pub mod prelude {
    pub use crate::{
        components::{ParallaxCamera, ParallaxLayer},
        flags::ParallaxFlags,
        plugin::ParallaxPlugin,
    };
}
/// Test the readme example
#[doc = include_str!("../README.md")]
#[cfg(doctest)]
struct ReadmeDocTests;