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.
GameSessioncoordinates start, pause, restart and fixed simulation time.SessionConfigvalidates reusable settings; setup and inspector errors stay atcrate::core::FixedClockErrorandcrate::session::SessionStepError.TickBatchyieldsTickContextvalues with each scheduled update’s ID and delta; scheduled IDs are distinct from executed-update counts.Vec2,Vec3,Mat4and the other math types are shared by all engines.ActionMaphandles platform-independent actions;PlayerInputconnects those actions to the renderer’s platform input and controls UI.Camera2D,Camera3DandConfconfigure the renderer. Drawing, frame scheduling and low-level input polling stay qualified asrender::….
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§
- Action
Map - Registration/rebinding may allocate. Feeds, consumption and context changes
reuse bounded storage.
ActionHandleaccess checks map ownership and bounds in constant time without allocating. Legacyusizeaccess 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.
- Fixed
Clock - Frame-rate independent simulation with bounded catch-up work.
- Frame
Step - A fixed simulation step budget with a fractional render interpolation factor.
- Game
Session - A local game lifecycle with an owned, deterministic
FixedClock. - Mat4
- Column-major 4x4 matrix acting on column vectors:
translation * rotation * scale. - Player
Input - Quat
- Quaternion stored as vector part
(x,y,z)followed by scalar partw. - Rect
- Axis-aligned 2D rectangle. Width and height should be nonnegative.
- Session
Config - Validated, reusable settings for a
GameSession. - Tick
Batch - An allocation-free snapshot of a frame budget and its scheduled tick IDs.
- Tick
Context - Context for one scheduled fixed update, produced by
TickBatch::ticks. - Vec2
- Vec3
- World
- Sparse typed storage with generational entities and checked component borrows.
Enums§
- Action
Kind - Input
Code - KeyCode
- Mouse
Button - Session
State - Host lifecycle state, independent of a game’s simulation-specific phases.