use crate::textures::{TextureManager, TextureSize};
use std::error::Error;
use log::debug;
#[derive(Debug)]
pub struct TextureLoader {
size: TextureSize
}
impl TextureManager for TextureLoader {
fn load(size: TextureSize) -> Result<Self, Box<dyn Error>> where Self: Sized {
debug!("Using slow texture loader, textures will be loaded on-the-fly");
Ok(TextureLoader {
size
})
}
fn get_texture(&self, texture_id: &str) -> Option<String> {
Some(format!("/../assets/final/{}/{}.png", self.size.to_string(), texture_id))
}
}