RUST · GAME UI & HUD

minimal-hud-rs — Zero-Allocation Event-Driven Game HUD State Machine in Rust

minimal-hud-rs is a lightweight Rust state engine for managing game HUD widgets, damage indicators, objective markers, and contextual auto-hide timers. It processes gameplay telemetry events with zero heap allocations and outputs normalized layout state for any 2D renderer.

$ cargo add minimal-hud-rs
GitHub ↗
01. Live Simulation & Engine Profiler [ INTERACTIVE WEBAUDIO & 60FPS TICK ]
Live HUD Simulation
ENGINE: Rust v1.98 FREQ: 60Hz VOICE: Normal (5.0m)
❤️
🛡️
⚡
🍔
💧
🧠
🤿
🎙️
0
N MPH
🚨 💡 ⛽ 🔧 🅿️
Dirty-Checking Event Engine Profiler ● ACTIVE
0
Ticks Evaluated
0
UI Redraws Dispatched
0.0%
Render Cycles Saved
DIRTY FLAGS MASK (CURRENT FRAME)
HEALTH ARMOR STAMINA HUNGER THIRST STRESS OXYGEN VOICE SPEED RPM GEAR FUEL ENGINE SEATBELT
Performance Benchmarks (vs FiveM Lua/NUI) ⚡ ZERO-COST
Full HUD Step
11.94 ns
83.8M steps/sec
Redraw Savings
67.9%
Epsilon filtered
Exp Smoothing
5.80 ns
172M steps/sec
Pulse & Audio
8.22 ns
121M steps/sec
Memory: <12 KB vs 50 MB CEF View Full Benchmarks Report →
Simulation Controls

Health 100%
Armor 50%
Hunger 100%
Thirst 100%
Vehicle Speed 0 MPH
Vehicle Fuel 100%
Engine Health 1000 / 1000
02. Crate Architecture & Integration [ RUST QUICK START ]
Cargo.toml TOML
[dependencies]
minimal-hud-rs = "0.1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
src/main.rs RUST
use minimal_hud_rs::{HudState, VitalStats, VehicleTelemetry, DirtyFlags};

fn main() {
    let mut hud = HudState::new();

    // Update vitals on game tick
    hud.update_health(75.0);
    hud.update_hunger(40.0);

    // Zero-cost dirty check: only dispatch when flags are non-empty
    if let Some(dirty_payload) = hud.take_dirty() {
        println!("Dispatching HUD update: {:?}", dirty_payload);
    }
}
COMMAND COPIED TO CLIPBOARD