Skip to main content

euv_engine/scheduler/
trait.rs

1/// The trait that game implementations must fulfill to receive
2/// fixed-timestep update and interpolated render callbacks from the scheduler.
3pub trait TickHandler {
4    /// Called at a fixed interval defined by `SchedulerConfig::fixed_timestep`.
5    ///
6    /// All game logic, physics, and state mutations should happen here.
7    ///
8    /// # Arguments
9    ///
10    /// - `f64` - The fixed delta time in seconds.
11    fn on_update(&mut self, delta_time: f64);
12
13    /// Called once per animation frame after all accumulated updates have been processed.
14    ///
15    /// The interpolation factor represents how far between fixed updates the current
16    /// frame is, allowing smooth rendering at variable frame rates.
17    ///
18    /// # Arguments
19    ///
20    /// - `f64` - The interpolation factor in the range 0.0 to 1.0.
21    fn on_render(&mut self, interpolation: f64);
22}