Skip to main content

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. [`gamepad::GamepadPlugin`]/
32//! [`audio::AudioPlugin`] are built in the same way, alongside it.
33
34pub mod app;
35pub mod assets;
36pub mod audio;
37pub mod ecs;
38pub mod gamepad;
39pub mod prelude;
40pub mod rendering;
41pub mod threading;
42pub mod time;
43pub mod wgpu;