diff options
| author | Raymond Hogenson <rhogenson@posteo.net> | 2018-08-18 14:49:42 -0400 |
|---|---|---|
| committer | Raymond Hogenson <rhogenson@posteo.net> | 2018-08-18 14:49:42 -0400 |
| commit | e8b4d6a42ef2f45e9ccc5d1b068bb176cedc8695 (patch) | |
| tree | 6cfe112b579e8cc6a812245142c37835b218adcd /src/state.rs | |
| parent | Change draw order (diff) | |
| download | stallman-shooter-e8b4d6a42ef2f45e9ccc5d1b068bb176cedc8695.tar.zst | |
Improve performance
I profiled it and this was the slowest part.
Diffstat (limited to 'src/state.rs')
| -rw-r--r-- | src/state.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/state.rs b/src/state.rs index f70c0ba..d309862 100644 --- a/src/state.rs +++ b/src/state.rs @@ -240,9 +240,7 @@ impl Positioned for Enemy { pub trait Drawable : Positioned { fn center(&self) -> (u32, u32); - fn draw(&self, canvas: &mut sdl2::render::WindowCanvas, surface: &sdl2::surface::Surface) { - let texture_creator = canvas.texture_creator(); - let texture = texture_creator.create_texture_from_surface(surface).unwrap(); + fn draw(&self, canvas: &mut sdl2::render::WindowCanvas, texture: &sdl2::render::Texture) { let tw = texture.query().width; let th = texture.query().height; let (cx, cy) = self.center(); |
