nightshade 0.13.3

A cross-platform data-oriented game engine.
Documentation
//! Audio playback using the Kira audio engine.
//!
//! Provides components for spatial and non-spatial audio:
//!
//! - [`AudioSource`]: Audio clip playback with volume, looping, and spatial settings
//! - [`AudioListener`]: Marker for the entity that receives spatial audio
//!
//! Audio assets are loaded through the asset system and referenced by name.
//! Spatial audio uses the entity's transform for 3D positioning.
//! The audio feature is optional and requires the `audio` feature flag.
//!
//! # Loading Audio
//!
//! Load audio files and register them with the audio manager:
//!
//! ```ignore
//! let sound_data = load_sound_from_bytes(include_bytes!("../assets/music.ogg"));
//! world.resources.audio.load_sound("background_music", sound_data);
//! ```
//!
//! # Playing Non-Spatial Audio
//!
//! ```ignore
//! let entity = world.spawn_entities(AUDIO_SOURCE, 1)[0];
//! world.core.set_audio_source(entity, AudioSource::new("background_music")
//!     .with_volume(0.8)
//!     .with_looping(true)
//!     .playing());
//! ```
//!
//! # Spatial Audio Setup
//!
//! For 3D positional audio, add an [`AudioListener`] to your camera and use
//! spatial audio sources with transforms:
//!
//! ```ignore
//! // Add listener to camera (typically done once in initialize)
//! world.core.add_audio_listener(camera_entity);
//! world.core.set_audio_listener(camera_entity, AudioListener);
//!
//! // Create spatial audio source at a position
//! let source = world.spawn_entities(
//!     AUDIO_SOURCE | LOCAL_TRANSFORM | GLOBAL_TRANSFORM | LOCAL_TRANSFORM_DIRTY,
//!     1
//! )[0];
//! world.core.set_audio_source(source, AudioSource::new("explosion")
//!     .with_spatial(true)
//!     .with_volume(1.0)
//!     .playing());
//! world.core.set_local_transform(source, LocalTransform {
//!     translation: Vec3::new(10.0, 0.0, 5.0),
//!     ..Default::default()
//! });
//! ```
//!
//! # WebAssembly Note
//!
//! On WASM, browsers require audio to be initialized after a user interaction
//! (click, touch, or keypress). The audio system handles this automatically,
//! but sounds triggered before any user input will be queued and played once
//! interaction occurs. For best results, trigger initial audio playback in
//! response to user input (e.g., a "Start" button click).

#[cfg(feature = "fft")]
pub mod analyzer;
pub mod components;
#[cfg(feature = "audio")]
pub mod resources;
#[cfg(feature = "audio")]
pub mod systems;

#[cfg(feature = "fft")]
pub use analyzer::*;
pub use components::*;
#[cfg(feature = "audio")]
pub use resources::*;
#[cfg(feature = "audio")]
pub use systems::*;