Make States a Resource

This commit is contained in:
hodasemi 2025-04-06 09:47:32 +02:00
parent 956122549e
commit 645dc8d017

View file

@ -2,7 +2,6 @@ use crate::prelude::*;
use anyhow::Result; use anyhow::Result;
use assetpath::AssetPath; use assetpath::AssetPath;
use ecs::*; use ecs::*;
use std::any::Any; use std::any::Any;
use std::collections::HashMap; use std::collections::HashMap;
@ -118,6 +117,7 @@ impl<'a, T: TopLevelGui + 'static> From<T> for CreationType<'a> {
} }
/// Collection and handler for your UI (basically a state machine) /// Collection and handler for your UI (basically a state machine)
#[derive(Resource)]
pub struct States { pub struct States {
states: HashMap<String, Arc<State>>, states: HashMap<String, Arc<State>>,
current_state: Arc<Mutex<Option<Arc<State>>>>, current_state: Arc<Mutex<Option<Arc<State>>>>,