}
}
- pub fn load_sprites(&mut self, sprites: &[(&'static str, &str)]) {
+ pub fn load_sprites(&mut self, sprites: &[(&str, &str)]) {
for (name, file) in sprites {
self.sprites.load(name, file);
}
pub struct SpriteManager {
texture_creator: TextureCreator<WindowContext>, // can't make the lifetimes work when this is owned instead of borrowed
- textures: HashMap<&'static str, Texture>,
+ textures: HashMap<String, Texture>,
}
impl SpriteManager {
}
}
- pub fn load(&mut self, name: &'static str, file: &str) {
- self.textures.insert(name, self.texture_creator.load_texture(file).unwrap());
+ pub fn load(&mut self, name: &str, file: &str) {
+ self.textures.insert(name.to_string(), self.texture_creator.load_texture(file).unwrap());
}
pub fn get(&self, name: &str) -> &Texture {