diff options
Diffstat (limited to 'src/layer.rs')
-rw-r--r-- | src/layer.rs | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/layer.rs b/src/layer.rs index 0247d81..ef21059 100644 --- a/src/layer.rs +++ b/src/layer.rs @@ -11,6 +11,20 @@ pub struct Layer { height: usize, } +impl Operable for Layer { + fn update(&mut self) { + for tile in self.tiles.iter_mut() { + tile.update(); + } + } + + fn draw(&self, spritebatch: &mut SpriteBatch) { + for tile in self.tiles.iter() { + tile.draw(spritebatch); + } + } +} + impl Layer { pub fn new(text: &str, tileset: &Tileset, width: usize, height: usize) -> Layer { Layer { @@ -24,16 +38,4 @@ impl Layer { height, } } - - pub fn update(&mut self) { - for tile in self.tiles.iter_mut() { - tile.update(); - } - } - - pub fn draw(&self, spritebatch: &mut SpriteBatch) { - for tile in self.tiles.iter() { - tile.draw(spritebatch); - } - } } |