diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-14 12:17:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-14 12:17:53 +0200 |
commit | b9b6102b916a679429acfd5a56b1acf353a11b0e (patch) | |
tree | 7568743d8f6925e47a6dddaa6f318ba5bf1ab962 /scene/2d/camera_2d.cpp | |
parent | a96c96ca7241974b1f86156a0ee70a87eae7b3e7 (diff) | |
parent | c390f0515d518c1a9bbaecf5d47718ff91bdbae5 (diff) |
Merge pull request #51660 from AnilBK/use-short-functions
Use get_global_* functions instead of using transforms.
Diffstat (limited to 'scene/2d/camera_2d.cpp')
-rw-r--r-- | scene/2d/camera_2d.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index ac75d81272..13b37aa2b2 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -96,7 +96,7 @@ Transform2D Camera2D::get_camera_transform() { Size2 screen_size = _get_camera_screen_size(); - Point2 new_camera_pos = get_global_transform().get_origin(); + Point2 new_camera_pos = get_global_position(); Point2 ret_camera_pos; if (!first) { @@ -169,7 +169,7 @@ Transform2D Camera2D::get_camera_transform() { Point2 screen_offset = (anchor_mode == ANCHOR_MODE_DRAG_CENTER ? (screen_size * 0.5 * zoom) : Point2()); - real_t angle = get_global_transform().get_rotation(); + real_t angle = get_global_rotation(); if (rotating) { screen_offset = screen_offset.rotated(angle); } @@ -305,8 +305,8 @@ void Camera2D::_notification(int p_what) { limit_drawing_width = 3; } - Vector2 camera_origin = get_global_transform().get_origin(); - Vector2 camera_scale = get_global_transform().get_scale().abs(); + Vector2 camera_origin = get_global_position(); + Vector2 camera_scale = get_global_scale().abs(); Vector2 limit_points[4] = { (Vector2(limit[SIDE_LEFT], limit[SIDE_TOP]) - camera_origin) / camera_scale, (Vector2(limit[SIDE_RIGHT], limit[SIDE_TOP]) - camera_origin) / camera_scale, @@ -489,7 +489,7 @@ void Camera2D::align() { Size2 screen_size = _get_camera_screen_size(); - Point2 current_camera_pos = get_global_transform().get_origin(); + Point2 current_camera_pos = get_global_position(); if (anchor_mode == ANCHOR_MODE_DRAG_CENTER) { if (drag_horizontal_offset < 0) { camera_pos.x = current_camera_pos.x + screen_size.x * 0.5 * drag_margin[SIDE_RIGHT] * drag_horizontal_offset; |