diff options
| author | Sofox | 2017-10-26 20:08:40 +0100 |
|---|---|---|
| committer | Sofox | 2017-10-26 20:42:51 +0100 |
| commit | 43cbef219b13ce9a491b353500f5d0e3dae30452 (patch) | |
| tree | 580b57080430fc4b0b7b9beffeaf6e66ba7a6337 /scene/2d/parallax_background.cpp | |
| parent | 2987e6ce4ffc69da5efc0903cc00ce12e72d2125 (diff) | |
| download | godot-43cbef219b13ce9a491b353500f5d0e3dae30452.tar.gz godot-43cbef219b13ce9a491b353500f5d0e3dae30452.tar.zst godot-43cbef219b13ce9a491b353500f5d0e3dae30452.zip | |
Diffstat (limited to 'scene/2d/parallax_background.cpp')
| -rw-r--r-- | scene/2d/parallax_background.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/scene/2d/parallax_background.cpp b/scene/2d/parallax_background.cpp index a13ce6278..b9012e37b 100644 --- a/scene/2d/parallax_background.cpp +++ b/scene/2d/parallax_background.cpp @@ -47,10 +47,12 @@ void ParallaxBackground::_notification(int p_what) { } } -void ParallaxBackground::_camera_moved(const Transform2D &p_transform) { +void ParallaxBackground::_camera_moved(const Transform2D &p_transform, const Point2 &p_screen_offset) { + + screen_offset = p_screen_offset; set_scroll_scale(p_transform.get_scale().dot(Vector2(0.5, 0.5))); - set_scroll_offset(p_transform.get_origin() / p_transform.get_scale()); + set_scroll_offset(p_transform.get_origin()); } void ParallaxBackground::set_scroll_scale(float p_scale) { @@ -106,9 +108,9 @@ void ParallaxBackground::_update_scroll() { continue; if (ignore_camera_zoom) - l->set_base_offset_and_scale(ofs, 1.0); + l->set_base_offset_and_scale(ofs, 1.0, screen_offset); else - l->set_base_offset_and_scale(ofs, scale); + l->set_base_offset_and_scale(ofs, scale, screen_offset); } } |
