nightshade 0.8.2

A cross-platform data-oriented game engine.
Documentation
//! Text rendering for HUD, UI, and 3D world text.
//!
//! Render text with SDF (Signed Distance Field) fonts for crisp scaling:
//!
//! - [`HudText`]: Screen-space text anchored to screen edges/center
//! - [`TextProperties`]: Font size, color, alignment, outline settings
//! - [`HudAnchor`]: Screen position anchor (TopLeft, Center, BottomRight, etc.)
//! - [`spawn_hud_text`]: Create screen-space text entity
//! - [`load_font_from_bytes`]: Load custom SDF fonts
//!
//! # Basic HUD Text
//!
//! ```ignore
//! use nightshade::ecs::text::{spawn_hud_text, HudAnchor};
//!
//! // Score display in top-left
//! let score_text = spawn_hud_text(
//!     world,
//!     "Score: 0",
//!     HudAnchor::TopLeft,
//!     Vec2::new(20.0, 20.0),  // Offset from anchor
//! );
//! ```
//!
//! # Styled Text
//!
//! ```ignore
//! use nightshade::ecs::text::{spawn_hud_text_with_properties, TextProperties, HudAnchor};
//!
//! let title = spawn_hud_text_with_properties(
//!     world,
//!     "GAME OVER",
//!     HudAnchor::Center,
//!     Vec2::zeros(),
//!     TextProperties {
//!         font_size: 48.0,
//!         color: Vec4::new(1.0, 0.2, 0.2, 1.0),  // Red
//!         alignment: TextAlignment::Center,
//!         outline_width: 2.0,
//!         outline_color: Vec4::new(0.0, 0.0, 0.0, 1.0),
//!         ..Default::default()
//!     },
//! );
//! ```
//!
//! # Updating Text Content
//!
//! ```ignore
//! // Update the text string
//! let new_index = world.resources.text_cache.add_text(format!("Score: {}", score));
//!
//! if let Some(hud_text) = world.get_hud_text_mut(score_text) {
//!     hud_text.set_text_index(new_index);
//! }
//! ```
//!
//! # Screen Anchors
//!
//! | Anchor | Position |
//! |--------|----------|
//! | `TopLeft` | Top-left corner |
//! | `TopCenter` | Top edge, centered |
//! | `TopRight` | Top-right corner |
//! | `CenterLeft` | Left edge, vertically centered |
//! | `Center` | Screen center |
//! | `CenterRight` | Right edge, vertically centered |
//! | `BottomLeft` | Bottom-left corner |
//! | `BottomCenter` | Bottom edge, centered |
//! | `BottomRight` | Bottom-right corner |
//!
//! # Text Properties
//!
//! | Property | Description | Default |
//! |----------|-------------|---------|
//! | `font_size` | Size in pixels | 16.0 |
//! | `color` | RGBA color | White |
//! | `alignment` | Left, Center, Right | Left |
//! | `vertical_alignment` | Top, Middle, Bottom, Baseline | Baseline |
//! | `line_height` | Line spacing multiplier | 1.2 |
//! | `letter_spacing` | Extra space between characters | 0.0 |
//! | `outline_width` | Outline thickness | 0.0 |
//! | `outline_color` | Outline RGBA color | Black |
//!
//! # Loading Custom Fonts
//!
//! Load SDF fonts generated with tools like msdf-atlas-gen:
//!
//! ```ignore
//! let font_data = include_bytes!("../assets/my_font.ttf").to_vec();
//! let font_index = load_font_from_bytes(world, font_data, 48.0)?;
//!
//! // Use custom font
//! let text = spawn_hud_text(world, "Custom Font", HudAnchor::Center, Vec2::zeros());
//! if let Some(hud_text) = world.get_hud_text_mut(text) {
//!     hud_text.set_font_index(font_index);
//! }
//! ```
//!
//! # Dynamic Color Changes
//!
//! ```ignore
//! if let Some(hud_text) = world.get_hud_text_mut(health_text) {
//!     let mut props = hud_text.properties.clone();
//!     props.color = if health < 25 {
//!         Vec4::new(1.0, 0.0, 0.0, 1.0)  // Red when low
//!     } else {
//!         Vec4::new(0.0, 1.0, 0.0, 1.0)  // Green when healthy
//!     };
//!     hud_text.set_properties(props);
//! }
//! ```
//!
//! [`HudText`]: components::HudText
//! [`TextProperties`]: components::TextProperties
//! [`HudAnchor`]: components::HudAnchor
//! [`spawn_hud_text`]: commands::spawn_hud_text
//! [`load_font_from_bytes`]: commands::load_font_from_bytes

pub mod commands;
pub mod components;
pub mod resources;
pub mod systems;

pub use commands::*;
pub use components::*;
pub use resources::*;
pub use systems::*;