Expand description
§rayengine
A small Linux-first Rust game SDK over raylib. Games are ordinary Cargo projects with a shared lifecycle for 2D and 3D, action input, fixed updates, fitted cameras, logical UI with optional interaction and explicit asset ownership. Version 0.0.3.
Start with the quickstart, then read game structure and scene switching and state stacks, and optional plugins. The remaining guides explain responsive viewports, timing and input, assets, arcade physics, streamed music and audio mixing, first-person movement, generated meshes, materials and shaders, spatial queries, grid pathfinding, background work, interactive UI and input routing, versioned saves, runtime diagnostics, testing and performance, and the agent workflow.
Optional rayengine.toml project descriptions share a CPU-only loader with the
CLI. See the project manifest guide
for profiles, asset/font declarations, validation and configuration precedence.
rayengine-core contains display-independent components and math; access it
through core or depend on it directly for simulations without raylib.
prelude contains the normal game imports. raylib remains available for
specialized rendering and other lower-level features.
use rayengine::prelude::*;
#[derive(Default)]
struct Hello;
impl Game for Hello {
fn fixed_update(&mut self, _: &mut Update<'_, '_>) {}
fn draw(&mut self, frame: &mut Frame<'_, '_>) {
frame.clear(Color::new(18, 29, 48, 255));
frame.world_2d(Camera2D::default(), |canvas| {
canvas.circle(Vec2::ZERO, 40.0, Color::SKYBLUE);
});
frame.ui(|ui| ui.text("Hello, rayengine", Vec2::new(24.0, 24.0), 24.0, Color::WHITE));
}
}
fn main() -> Result<(), Error> {
App::new(Config::new("Hello")).run(Hello)?;
Ok(())
}Custom outline fonts, matching label measurement, per-button font choice,
DPI-aware atlases, and explicit nearest-filtered pixel text are described in the
font guide.
The repository includes a distributable two-font example (--example fonts).
The first release provides basic swept character movement and geometric drawing, not rigid-body dynamics or an advanced 3D rendering pipeline. The interactive input/image/state testing protocol is deferred. The CLI’s JSON project diagnostics are available now. Desktop Linux is the supported development target; Windows and macOS are optional and not yet verified by this project’s CI.
Basic ambient, directional, and point lighting is opt-in with Shading::Lit.
See the lighting guide
and run cargo run -p rayengine --example lighting for a generated/imported
lit/unlit comparison with adjustable lights.
See the render targets and post-processing guide for offscreen 2D/3D rendering, reusable shader effects, and UI composition.
Re-exports§
pub use plugin::Plugin;pub use runtime::App;pub use runtime::Config;pub use runtime::CursorMode;pub use runtime::Error;pub use runtime::Game;pub use runtime::InitContext;pub use runtime::RunOptions;pub use runtime::RunReport;pub use runtime::Update;pub use rayengine_core as core;pub use raylib;
Modules§
- assets
- Cached asset ownership with typed stable handles and explicit unloading.
- audio
- Opt-in streamed music and one-shot mixing. See
crate::guides::audio. - diagnostics
- Opt-in, bounded runtime summaries. Timings are CPU wall times, not GPU timers.
- first_
person - Optional first-person movement over Body3D. Games own worlds, spawning, checkpoints, menus, interaction and input-edge consumption.
- fonts
- Owned outline fonts, target-aware rasterization, and shared text layout.
- guides
- Guides authored in Markdown and exported to HTML by rustdoc.
- input
- Configurable physical sources sampled once per render frame.
- lighting
- Basic world-space Lambert lighting shared by built-in lit materials.
- manifest
- Versioned, optional project descriptions shared by tools and the runtime.
- material
- Reusable surface descriptions and cached, typed shader parameters.
- pathfinding
- Grid navigation: A* paths, line-of-sight smoothing, path following and distance fields over caller-owned 2D grids.
- physics
- Predictable arcade physics with continuous translation and no rotation.
- plugin
- Optional, statically typed extensions composed by a game.
- post_
processing - Ordered full-frame material passes after the quality resolve, before presentation.
- prelude
- Common imports for a game using the prescribed lifecycle.
- render
- Immediate drawing with corresponding 2D/3D passes and shared logical UI.
- runtime
- Window lifecycle: initialize once, sample input, fixed-update, draw, present.
- save
- Versioned, checksummed containers for game-defined payloads.
- sprite
- Validated sprite regions and CPU-only animation with explicit simulation time.
- state
- Optional game-owned state composition. See
crate::guides::states. - targets
- Run-owned offscreen targets with explicit sampling, sizing and lifetime.
- upload
- Bounded CPU mesh staging and explicit render-thread upload budgets.
Structs§
- Render
Plan - Checked target dimensions and steady-state color/depth allocation estimate.
- Render
Quality - Rendering controls, independent of camera and UI coordinates.
Enums§
- Anti
Aliasing - Anti-aliasing applied to the game’s offscreen world before UI composition.