Module prelude

Source
Expand description

A deliberately small set of common engine entry points.

Import with use ferravex::prelude::*;. These are the original types, so they interoperate with the full crate::core, crate::math, crate::input and crate::render APIs without conversions.

There is no generic Camera, Mesh or Action alias: choose the appropriate subsystem explicitly when reaching beyond these entry points. In particular, use crate::app::AppFrameReport for lifecycle diagnostics, crate::time::SimulationTimer for timers and crate::feedback for accepted-event presentation. These systems do not expand wildcard imports.

use ferravex::prelude::*;

let mut actions = ActionMap::default();
let right = actions.action(vec![Binding::digital(
    InputCode::Key(KeyCode::Right as u16),
)]);
let config = SessionConfig::try_new(60.0, 8, true)?;
let mut session = GameSession::from_config(config);
actions.feed(InputCode::Key(KeyCode::Right as u16), 1.0);
let mut position = Vec2::ZERO;
let batch: TickBatch = session.advance_batch(1.0 / 60.0);
for TickContext { tick, dt, .. } in batch.ticks() {
    // Consume edges per simulation tick, including catch-up ticks.
    let action = actions.consume_tick(right);
    position += vec2(action.value, 0.0) * 120.0 * dt;
    assert_eq!(tick, 1);
}
assert!((position.x - 2.0).abs() < 0.0001);

Re-exports§

pub use crate::render;

Structs§

ActionMap
Registration/rebinding may allocate. Feeds, consumption and context changes reuse bounded storage. ActionHandle access checks map ownership and bounds in constant time without allocating. Legacy usize access remains available.
Binding
Camera2D
Camera3D
Color
Unpremultiplied RGBA floating-point channels. No implicit gamma conversion.
Conf
Entity
Opaque slot identity. A despawned entity never becomes valid again in its world. Handles are world-local; two separate worlds may issue the same identity.
FixedClock
Frame-rate independent simulation with bounded catch-up work.
FrameStep
A fixed simulation step budget with a fractional render interpolation factor.
GameSession
A local game lifecycle with an owned, deterministic FixedClock.
Mat4
Column-major 4x4 matrix acting on column vectors: translation * rotation * scale.
PlayerInput
Quat
Quaternion stored as vector part (x,y,z) followed by scalar part w.
Rect
Axis-aligned 2D rectangle. Width and height should be nonnegative.
SessionConfig
Validated, reusable settings for a GameSession.
TickBatch
An allocation-free snapshot of a frame budget and its scheduled tick IDs.
TickContext
Context for one scheduled fixed update, produced by TickBatch::ticks.
Vec2
Vec3
World
Sparse typed storage with generational entities and checked component borrows.

Enums§

ActionKind
InputCode
KeyCode
MouseButton
SessionState
Host lifecycle state, independent of a game’s simulation-specific phases.

Functions§

vec2
vec3