Skip to main content

astrelis_core/
lib.rs

1//! Astrelis Core
2//!
3//! This crate provides the foundational functionality for the Astrelis game engine, including
4//! math utilities, logging, profiling, geometry types, and custom allocators.
5//!
6//! # Overview
7//!
8//! The `astrelis-core` crate is dependency-free (except for re-exported external crates) and
9//! serves as the foundation for all other Astrelis crates. It provides:
10//!
11//! - **Math**: Re-exports of `glam` types ([`Vec2`], [`Vec3`], [`Mat4`], etc.) for linear algebra
12//! - **Logging**: Structured logging via `tracing` with [`logging::init()`]
13//! - **Profiling**: Performance profiling integration with `puffin` via [`profiling`]
14//! - **Geometry**: Common 2D geometry types (sizes, positions, coordinate spaces)
15//! - **Allocators**: Custom allocators like `ahash` for fast hashing
16//!
17//! # Modules
18//!
19//! - [`math`]: Linear algebra types and utilities (re-exports `glam`)
20//! - [`logging`]: Initialize and configure tracing-based logging
21//! - [`profiling`]: Performance profiling with puffin integration
22//! - [`geometry`]: 2D geometry primitives (rectangles, transforms, etc.)
23//! - [`alloc`]: Custom allocators and hash functions
24//!
25//! # Quick Start
26//!
27//! ```no_run
28//! use astrelis_core::{logging, math::Vec2};
29//!
30//! // Initialize logging (outputs to stdout with timestamps)
31//! logging::init();
32//!
33//! // Use math types
34//! let position = Vec2::new(10.0, 20.0);
35//! let velocity = Vec2::new(1.0, 0.5);
36//! let new_position = position + velocity * 0.016; // Delta time
37//!
38//! tracing::info!("New position: {:?}", new_position);
39//! ```
40//!
41//! # Usage with Other Crates
42//!
43//! The `astrelis-core` crate is typically used as a foundation for higher-level crates:
44//!
45//! ```toml
46//! [dependencies]
47//! astrelis-core = "0.1"
48//! astrelis-winit = "0.1"  # Window management (depends on core)
49//! astrelis-render = "0.1" # Rendering (depends on core)
50//! ```
51//!
52//! # Feature Flags
53//!
54//! - `profiling` (default): Enables puffin-based profiling. When disabled, all profiling
55//!   macros and functions become zero-cost no-ops.
56//! - `winit` (default): Enables winit window type re-exports.
57//!
58//! # See Also
59//!
60//! - [Getting Started Guide](https://docs.rs/astrelis/latest/astrelis/guides/getting-started/)
61//! - [Architecture Overview](https://docs.rs/astrelis/latest/astrelis/guides/architecture/)
62//!
63//! [`Vec2`]: math::Vec2
64//! [`Vec3`]: math::Vec3
65//! [`Mat4`]: math::Mat4
66
67pub mod alloc;
68pub mod geometry;
69pub mod logging;
70pub mod math;
71pub mod profiling;