euv-engine 0.12.27

A high-performance 2D game engine built on the euv framework, featuring ECS, fixed-timestep game loop, canvas rendering, physics, collision detection, sprite animation, and audio.
Documentation
use super::*;

/// A reference-counted shared-mutable container for a `dyn TickHandler`.
///
/// Holds a `dyn TickHandler` behind `EngineCell` (an `UnsafeCell`-backed
/// `Sync` newtype), so the multi-owner shared-mut pattern that
/// `Rc<RefCell<T>>` used to express is now expressed without `RefCell` -
/// matching the rest of the engine's `static mut` convention.
///
/// # Access
///
/// Use [`EngineCell::get_mut`] for unconditional mutable access.
pub type TickHandlerRc = Rc<EngineCell<dyn TickHandler>>;

/// A reference-counted `requestAnimationFrame` closure cell.
///
/// Holds an `Option<Closure<dyn FnMut()>>` behind `MaybeEngineCell` so
/// the cell may legitimately be empty (no closure installed) before
/// `spawn` is called and after cleanup tears it down. Mirrors
/// `core::reactive::schedule::static::CURRENT_HOOK_CONTEXT` in shape.
///
/// # Access
///
/// Use [`MaybeEngineCell::try_get_mut`] for absent-or-present read,
/// [`MaybeEngineCell::try_set`] to install, [`MaybeEngineCell::try_take`]
/// to remove.
pub type RafClosureCell = Rc<MaybeEngineCell<Closure<dyn FnMut()>>>;