Crate bevy_mod_progress
source ·Expand description
§bevy_mod_progress
Strongly typed progress tracking. Based on the (very good) iyes_progress.
use bevy::prelude::*;
use bevy_mod_progress::*;
struct TrackerId;
fn main() {
let mut app = App::new();
app.add_plugins(DefaultPlugins);
app.add_plugins(ProgressTrackerPlugin::<TrackerId>::default());
app.add_systems(Update, tracking_system.track_progress::<TrackerId>()
.run_if(currently_tracking::<TrackerId>()));
app.add_systems(Done::<TrackerId>::new(), finished_system);
app.run();
}
fn tracking_system(
time: Res<Time<Real>>,
) -> Progress {
let ts = (time.elapsed_seconds() * 1000.0) as u32;
Progress {
done: ts.min(5000),
required: 5000,
}
}
fn finished_system(
time: Res<Time<Real>>,
) {
info!("Finished at {} seconds", time.elapsed_seconds());
}
Structs§
- Schedule run when the progress tracker corresponding to
T
finishes. - Overall recorded progress.
- Progress reported by a system.
- A simple progress tracker plugin. Runs the
Done
schedule when finished. - System set for systems that track progress.
Traits§
- Extension trait for systems that output
Progress
to record their progress. - Types that can be used in the progress tracker plugin as a distinguishing value. Automatically implemented for almost all types, so no need to worry about this.
Functions§
- Adds
OverallProgress<T>
to the World, allowing it to be tracked. - Removes
OverallProgress<T>
to the World, stopping tracking.