From 19ce5319e2250b7b0e1a188f69d24de282a85a7f Mon Sep 17 00:00:00 2001 From: troido Date: Mon, 3 Feb 2020 16:36:52 +0100 Subject: merged Draw into View; renamed Position to Pos --- src/systems/moving.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/systems/moving.rs') diff --git a/src/systems/moving.rs b/src/systems/moving.rs index c81a766..8bce8e5 100644 --- a/src/systems/moving.rs +++ b/src/systems/moving.rs @@ -8,7 +8,7 @@ use specs::{ }; use super::super::components::{ - Position, + Pos, Controller, Blocking }; @@ -26,12 +26,12 @@ use super::super::resources::{ pub struct Move; impl <'a> System<'a> for Move { - type SystemData = (ReadStorage<'a, Controller>, WriteStorage<'a, Position>, Read<'a, Size>, ReadStorage<'a, Blocking>, Read<'a, Floor>); + type SystemData = (ReadStorage<'a, Controller>, WriteStorage<'a, Pos>, Read<'a, Size>, ReadStorage<'a, Blocking>, Read<'a, Floor>); fn run(&mut self, (controller, mut pos, size, blocking, floor): Self::SystemData) { for (controller, pos) in (&controller, &mut pos).join(){ match &controller.0 { Control::Move(direction) => { - let newpos = (*pos + direction.to_position()).clamp(Position::new(0, 0), Position::new(size.width - 1, size.height - 1)); + let newpos = (*pos + direction.to_position()).clamp(Pos::new(0, 0), Pos::new(size.width - 1, size.height - 1)); let mut blocked = false; for ent in floor.cells.get(&newpos).unwrap_or(&Vec::new()) { if blocking.get(*ent).is_some(){ -- cgit