summaryrefslogtreecommitdiff
path: root/src/layer.rs
diff options
context:
space:
mode:
authortom barrett <spalf0@gmail.com>2019-07-05 02:50:38 -0500
committertom barrett <spalf0@gmail.com>2019-07-05 02:50:38 -0500
commit6589e5e3df63d5abf85313c4d21097432257f453 (patch)
treed53635ead10c9fa9dc951045eff9e31977457f8c /src/layer.rs
parent83ff2ad49e6d3bf83fd85fcfee68a454372bf22a (diff)
removed math, operable to map and layers, on the way to merging tile and frame
Diffstat (limited to 'src/layer.rs')
-rw-r--r--src/layer.rs26
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);
- }
- }
}