diff options
author | Nao Pross <naopross@thearcway.org> | 2019-01-14 16:09:19 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2019-01-14 16:09:19 +0100 |
commit | 815acf212a11c7465830df68d8784a2daf941e2f (patch) | |
tree | cb1cf8e2ccd9c1b86482f88333cd5147d48571e8 /src | |
parent | Change titlebar style to allow resizing (diff) | |
download | Subconscious-rs-815acf212a11c7465830df68d8784a2daf941e2f.tar.gz Subconscious-rs-815acf212a11c7465830df68d8784a2daf941e2f.zip |
Rename view in MapScene for future impl with more views (ex MiniMap)
Diffstat (limited to '')
-rw-r--r-- | src/graphics.rs | 12 |
1 files 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); } } _ => {}, |