Commit d93a8b0b authored by Rahix's avatar Rahix 🦀
Browse files

sprites: Bulk-initialize all known sprites

parent 8a478b46
......@@ -25,6 +25,12 @@ impl Sprite {
.register_image_on_handle(image, &image_handle)
.expect("ImageHandle was registered twice - this should not happen");
}
pub async fn load_and_register_all(renderer: &mut resources::Rendering) {
for sprite in &[Sprite::Player] {
sprite.load_and_register(renderer).await;
}
}
}
impl Into<resources::ImageHandle> for Sprite {
......
......@@ -60,9 +60,7 @@ impl gamestate::State for LevelLoadingState {
.await
.unwrap();
sprites::Sprite::Player
.load_and_register(&mut rendering)
.await;
sprites::Sprite::load_and_register_all(&mut rendering).await;
handle.do_transition(gamestate::Transition::replace(states::InGameState::new(
level,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment