[package]
name = "mawida"
version = "0.4.0"
edition = "2021"
rust-version = "1.86"
description = "A small, code-first, modern 2D game engine in Rust, built on wgpu. 2D today, with the seams cut for 3D, VR, and embedded scripting."
authors = ["Francisco R. Ortega, Ph.D."]
license = "BSD-2-Clause"
homepage = "https://mawida.com"
repository = "https://git.nuilab.org/fortega/mawida-engine"
keywords = ["gamedev", "graphics", "wgpu", "2d", "engine"]
categories = ["game-development", "graphics"]
# keep session reports, backups, and editor config out of the published crate
exclude = ["reports/", "bck/", ".vscode/", "assets/sounds/", "alias/"]

# ---------------------------------------------------------------------------
# Dependency versions verified against crates.io on 2026-06-27.
# Re-verify before bumping. Do NOT trust training-data version numbers.
# ---------------------------------------------------------------------------

[features]
# `runtime`  = the windowing + GPU layer (winit + wgpu). Pulls heavy deps.
# `audio`    = sound playback via rodio.
# Disable default features to build/test ONLY the pure-logic core
# (math, time, color, transform, input, camera, drawable) with no GPU/winit.
default = ["runtime", "audio"]
runtime = ["dep:winit", "dep:wgpu", "dep:pollster", "dep:raw-window-handle", "dep:env_logger", "dep:log"]
audio = ["dep:rodio"]
# `lua` = the first real ScriptHost binding (v0.2 step 13). NOT in default:
# the core never names a language, and nobody pays for scripting unasked.
lua = ["dep:mlua", "dep:log"]
# `gltf` = 3D model file loading (v0.3). NOT in default: 2D games do not
# pay for a scene-format parser they never call.
gltf = ["dep:gltf"]
# `physics` = real 2D rigid-body dynamics via rapier (v0.4). NOT in default:
# collide.rs stays the zero-dep teaching tier; rapier is the "real games"
# tier above it, as a module you register.
physics = ["dep:rapier2d", "dep:log"]
# `gamepad` = controller input via gilrs (v0.4). NOT in default.
gamepad = ["dep:gilrs", "dep:log"]
# `xr` = OpenXR via the wgpu-hal Vulkan handoff (item 18). NOT in default.
# Linux/Vulkan only in practice (macOS has no OpenXR runtime); compiles
# everywhere so the seam stays honest. Proven headless on area51 via the
# CCF sibling; this port brings the recipe into the teaching engine.
xr = ["dep:openxr", "dep:ash", "dep:wgpu-types", "dep:log", "runtime"]

[dependencies]
# --- core (always compiled) ---
glam = "0.33.1"          # math: Vec2/Vec3/Vec4/Mat4/Quat. Always 3D-capable, even in 2D.
bytemuck = { version = "1.25.0", features = ["derive"] }  # Pod/Zeroable for GPU vertex upload.
thiserror = "2.0.18"     # error enum derive.
image = "0.25.10"        # CPU image decode (PNG etc.) for texture loading.

# --- runtime feature (windowing + GPU) ---
winit = { version = "0.30.13", optional = true }
wgpu = { version = "29.0.3", optional = true }
pollster = { version = "0.4.0", optional = true }          # block_on for async wgpu init.
raw-window-handle = { version = "0.6.2", optional = true }
env_logger = { version = "0.11.11", optional = true }
log = { version = "0.4.33", optional = true }

# --- audio feature ---
rodio = { version = "0.22.2", optional = true }

# --- gltf feature ---
# Version checked on crates.io 2026-07-07 (1.4.1). MIT OR Apache-2.0.
gltf = { version = "1.4.1", optional = true }

# --- physics feature ---
# Version checked on crates.io 2026-07-07 (0.34.0, released 2026-07-04).
# Apache-2.0. Pure Rust: headless-testable like everything else we ship.
rapier2d = { version = "0.34.0", optional = true }

# --- gamepad feature ---
# Version checked on crates.io 2026-07-07 (0.11.2). MIT OR Apache-2.0.
gilrs = { version = "0.11.2", optional = true }

# --- xr feature ---
# openxr checked on crates.io 2026-07-06 (0.21.1). ash MUST track wgpu-hal's
# ash exactly (hal types and ours must be the same crate): 0.38.0 for wgpu 29.
openxr = { version = "0.21.1", optional = true }
ash = { version = "0.38.0", optional = true }
wgpu-types = { version = "29.0.3", optional = true }

# --- lua feature ---
# Version checked on crates.io 2026-07-07 (0.12.0, released 2026-07-05), per
# the dependency policy. vendored: builds Lua 5.4 from source, no system Lua.
mlua = { version = "0.12.0", features = ["lua54", "vendored"], optional = true }

[[example]]
name = "hello_quad"
required-features = ["runtime"]

[[example]]
name = "hello_quad_ecs"
required-features = ["runtime", "audio"]

[[example]]
name = "sprite_storm"
required-features = ["runtime"]

[[example]]
name = "walker"
required-features = ["runtime"]

[[example]]
name = "fps_text"
required-features = ["runtime"]

[[example]]
name = "bounce"
required-features = ["runtime"]

[[example]]
name = "lua_fountain"
required-features = ["runtime", "lua"]

[[example]]
name = "cube3d"
required-features = ["runtime", "gltf"]

[[example]]
name = "ecs_assets"
required-features = ["runtime", "audio"]

[[example]]
name = "xr_smoke"
required-features = ["xr"]

[profile.dev]
# wgpu is far more usable with optimized deps even in debug.
opt-level = 1

[profile.dev.package."*"]
opt-level = 3
