Use unsafe textures and move some things into an app object
[kaka/rust-sdl-test.git] / src / sprites.rs
index 82dd6dc..57fc0a4 100644 (file)
@@ -5,13 +5,13 @@ use sdl2::render::Texture;
 use sdl2::render::TextureCreator;
 use sdl2::video::WindowContext;
 
-pub struct SpriteManager<'canvas> {
-    texture_creator: &'canvas TextureCreator<WindowContext>, // can't make the lifetimes work when this is owned instead of borrowed
-    textures: HashMap<&'static str, Texture<'canvas>>,
+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>,
 }
 
-impl<'canvas> SpriteManager<'canvas> {
-    pub fn new(texture_creator: &'canvas TextureCreator<WindowContext>) -> SpriteManager<'canvas> {
+impl SpriteManager {
+    pub fn new(texture_creator: TextureCreator<WindowContext>) -> SpriteManager {
         SpriteManager {
             texture_creator,
             textures: HashMap::new(),