pebble/lib.rs
1//! A modular, ECS-style graphics/app framework.
2//!
3//! Start with [`prelude`] — `use pebble::prelude::*;` pulls in the types
4//! you need for almost everything below.
5//!
6//! The lifecycle: build an [`app::App`], register [`ecs::plugin::Plugin`]s
7//! (a windowing backend, a graphics backend, your own gameplay plugins),
8//! register systems against an [`app::SystemStage`], then [`app::App::build`]
9//! and [`app::App::run`]. Systems are plain functions whose parameters
10//! (`Res`, `ResMut`, `Query`, `Commands`, ...) declare what ECS state they
11//! touch — see [`ecs::system`] for the full set.
12//!
13//! Assets flow through a unified store: CPU-side source data and the
14//! uploaded result both live in [`assets::storage::Assets`] per entry.
15//! An [`assets::plugin::AssetPlugin`] calls [`assets::upload::Asset::upload`]
16//! each tick; rendering systems then use [`Assets::get`] to read the
17//! processed result. [`assets::handle::Handle`] is the typed key.
18//!
19//! [`rendering`] defines the backend-agnostic contract ([`rendering::backend::Backend`],
20//! [`rendering::window::WindowProvider`]); [`wgpu`] is a ready-to-use wgpu
21//! implementation of it, plus a higher-level descriptor-based material/mesh/
22//! texture layer (see [`wgpu::backend::WGPUPlugin`]) that needs far less
23//! boilerplate than implementing `Backend`/`Asset` by hand.
24//!
25//! [`threading::BackgroundTasks`] offloads CPU-bound work to a worker pool;
26//! [`ecs::events`] and [`ecs::system::AsyncExt`] build on it for ECS events
27//! and fire-and-forget async systems.
28//!
29//! [`time::TimePlugin`] ticks [`time::Time`] (delta/elapsed seconds, fps)
30//! once per frame in `PreUpdate` — backend-agnostic, so it works the same
31//! whether or not a graphics backend is even in use. [`audio::AudioPlugin`]
32//! is built in the same way, alongside it — as is `gamepad::GamepadPlugin`
33//! on every target except `wasm32`, which doesn't have it at all.
34
35pub mod app;
36pub mod assets;
37pub mod audio;
38pub mod ecs;
39#[cfg(not(target_arch = "wasm32"))]
40pub mod gamepad;
41pub mod prelude;
42pub mod rendering;
43pub mod threading;
44pub mod time;
45pub mod wgpu;