use once_cell::sync::Lazy;
use std::collections::HashMap;
pub struct AssetRegistry {
assets: HashMap<String, String>,
}
impl AssetRegistry {
pub fn new() -> Self {
Self {
assets: HashMap::new(),
}
}
pub fn register(&mut self, name: String, path: String) {
self.assets.insert(name, path);
}
pub fn get(&self, name: &str) -> Option<&String> {
self.assets.get(name)
}
}
impl Default for AssetRegistry {
fn default() -> Self {
Self::new()
}
}
pub static ASSET_REGISTRY: Lazy<AssetRegistry> = Lazy::new(AssetRegistry::new);