From 2341ee664eb44b62c5d1bb0c2c6a7fea6ccb3ced Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Mon, 6 Jan 2025 16:42:48 +0200 Subject: [PATCH] fix(assets): wait for assets load --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/maze/assets.rs | 4 ++-- src/player/mod.rs | 2 +- src/screens/loading.rs | 10 ++++++++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3f5cf89..a3d251d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3129,7 +3129,7 @@ dependencies = [ [[package]] name = "maze-ascension" -version = "1.0.1" +version = "1.0.2" dependencies = [ "anyhow", "bevy", diff --git a/Cargo.toml b/Cargo.toml index f5d2266..3ef7be1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "maze-ascension" authors = ["Kristofers Solo "] -version = "1.0.1" +version = "1.0.2" edition = "2021" [dependencies] diff --git a/src/maze/assets.rs b/src/maze/assets.rs index 15350eb..006586a 100644 --- a/src/maze/assets.rs +++ b/src/maze/assets.rs @@ -37,8 +37,8 @@ pub struct MazeAssets { impl MazeAssets { /// Creates a new instance of MazeAssets with all necessary meshes and materials. pub fn new( - meshes: &mut ResMut>, - materials: &mut ResMut>, + meshes: &mut Assets, + materials: &mut Assets, global_config: &GlobalMazeConfig, ) -> Self { let custom_materials = RosePineDawn::iter() diff --git a/src/player/mod.rs b/src/player/mod.rs index 90a4592..05a0917 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -1,4 +1,4 @@ -mod assets; +pub mod assets; pub mod commands; pub mod components; mod systems; diff --git a/src/screens/loading.rs b/src/screens/loading.rs index 7460a5f..f96d866 100644 --- a/src/screens/loading.rs +++ b/src/screens/loading.rs @@ -4,6 +4,8 @@ use bevy::prelude::*; use crate::{ + hint::assets::HintAssets, + player::assets::PlayerAssets, screens::Screen, theme::{interaction::InteractionAssets, prelude::*}, }; @@ -33,6 +35,10 @@ fn continue_to_title_screen(mut next_screen: ResMut>) { next_screen.set(Screen::Title); } -const fn all_assets_loaded(interaction_assets: Option>) -> bool { - interaction_assets.is_some() +const fn all_assets_loaded( + player_assets: Option>, + interaction_assets: Option>, + hints_assets: Option>, +) -> bool { + player_assets.is_some() && interaction_assets.is_some() && hints_assets.is_some() }