From 815acf212a11c7465830df68d8784a2daf941e2f Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 14 Jan 2019 16:09:19 +0100 Subject: Rename view in MapScene for future impl with more views (ex MiniMap) --- src/graphics.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/graphics.rs b/src/graphics.rs index e4f8e38..3b08c77 100644 --- a/src/graphics.rs +++ b/src/graphics.rs @@ -117,7 +117,7 @@ trait Scene { } struct MapScene { - view: View, + map_view: View, // pan panning: bool, pan_start: Vector2f, @@ -129,7 +129,7 @@ struct MapScene { impl MapScene { fn new(window: &RenderWindow) -> MapScene { return MapScene { - view: window.default_view().to_owned(), + map_view: window.default_view().to_owned(), panning: false, pan_start: Vector2f::new(0.0, 0.0), tilesets: HashMap::new(), @@ -237,8 +237,8 @@ impl Scene for MapScene { Event::MouseWheelScrolled { wheel: _, delta, x: _, y: _ } => { // delta is probalby a value between -1 and 1 let zoom = 1.0 + delta * 0.1; - self.view.zoom(zoom); - window.set_view(&self.view); + self.map_view.zoom(zoom); + window.set_view(&self.map_view); }, Event::MouseButtonPressed { button, x, y} => { match button { @@ -266,8 +266,8 @@ impl Scene for MapScene { let delta = self.pan_start - window.map_pixel_to_coords_current_view(&Vector2i::new(x, y)); // move view by moving the center by delta - self.view.move_(delta); - window.set_view(&self.view); + self.map_view.move_(delta); + window.set_view(&self.map_view); } } _ => {}, -- cgit v1.2.1