Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

psx_fx/
lib.rs

1// SPDX-License-Identifier: GPL-2.0-or-later
2//! Arcade-style visual effects for PS1 homebrew.
3//!
4//! Extracted from the duplicated particle / shake / RNG pattern
5//! that breakout and invaders both grew independently. A *primitive*
6//! layer, not an engine:
7//!
8//! - [`rng::LcgRng`] -- deterministic, no_std, no_alloc integer
9//!   PRNG. Every consumer uses this for particle velocity spread
10//!   so replays + golden tests stay stable.
11//! - [`particles::ParticlePool`] -- fixed-size pool of short-lived
12//!   coloured dots with Q4.4 sub-pixel velocity, gravity, TTL-
13//!   based fade + size taper. Emits `RectFlat`s into an
14//!   [`psx_gpu::ot::OrderingTable`] at the caller's chosen depth.
15//! - [`shake::ShakeState`] -- frame-decay counter that produces a
16//!   triangle-wave `(dx, dy)` offset; caller folds it into vertex
17//!   positions when building the frame.
18//!
19//! The particle pool is generic over size (const generic), so each
20//! game picks a capacity that fits its budget -- 32 for a casual
21//! puzzler, 64 for a shoot-em-up, 256 for a bullet-hell.
22//!
23//! ## What's NOT here (on purpose)
24//!
25//! - Emitter objects, keyframed colour / size ramps, layer
26//!   compositing, collision response -- all engine-level. Those
27//!   land when a future `psx-engine` crate needs them.
28//! - Floats -- the PS1 has no FPU and we stay honest about that.
29//!   All math is fixed-point / integer.
30//! - Textures for particles -- particles are rasterised rects
31//!   today; a textured variant is a small addition if someone
32//!   needs sparkles later.
33
34#![no_std]
35#![deny(unsafe_op_in_unsafe_fn)]
36#![warn(missing_docs)]
37
38pub mod particles;
39pub mod rng;
40pub mod shake;
41
42pub use particles::{Particle, ParticlePool};
43pub use rng::LcgRng;
44pub use shake::ShakeState;