From 6589e5e3df63d5abf85313c4d21097432257f453 Mon Sep 17 00:00:00 2001 From: tom barrett Date: Fri, 5 Jul 2019 02:50:38 -0500 Subject: removed math, operable to map and layers, on the way to merging tile and frame --- src/layer.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/layer.rs') 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); - } - } } -- cgit v1.2.3