use std::hash::Hash;
use hashbrown::HashMap;
use crate::{
animation::{SpriteDesc, traits::AnimationAssets},
handle::Handle,
sprite::Sprite,
};
#[derive(Default)]
pub struct GameAssets<TextureKey, AudioKey, AudioData> {
pub textures: HashMap<TextureKey, Sprite>,
pub audios: HashMap<AudioKey, AudioData>,
pub fonts: HashMap<&'static str, Handle>,
pub sprite_descs: HashMap<&'static str, SpriteDesc<TextureKey>>,
}
impl<TextureKey: Eq + Hash, AudioKey, AudioData> AnimationAssets<TextureKey>
for GameAssets<TextureKey, AudioKey, AudioData>
{
fn get_texture(&self, sprite_key: &TextureKey) -> Option<&Sprite> {
self.textures.get(sprite_key)
}
fn get_sprite_desc(&self, desc_key: &str) -> Option<&SpriteDesc<TextureKey>> {
self.sprite_descs.get(desc_key)
}
}