diff options
author | alexholly <alexander.holland@live.de> | 2017-06-04 00:25:13 +0200 |
---|---|---|
committer | alexholly <alexander.holland@live.de> | 2017-06-04 02:09:17 +0200 |
commit | a3c90b029308eb46b7fd83a0cf7b502ecbd79d55 (patch) | |
tree | 37aaaa84b53d962b441de0683a502e189cb371bb /scene | |
parent | 69bec86028f87307e549d7a2f49bbb7e2b1f3771 (diff) |
renamed all Rect2.pos to Rect2.position
Diffstat (limited to 'scene')
39 files changed, 267 insertions, 267 deletions
diff --git a/scene/2d/camera_2d.cpp b/scene/2d/camera_2d.cpp index 71f651b0a4..9d8b5da366 100644 --- a/scene/2d/camera_2d.cpp +++ b/scene/2d/camera_2d.cpp @@ -120,20 +120,20 @@ Transform2D Camera2D::get_camera_transform() { Rect2 screen_rect(-screen_offset + camera_pos, screen_size * zoom); if (offset != Vector2()) - screen_rect.pos += offset; + screen_rect.position += offset; if (limit_smoothing_enabled) { - if (screen_rect.pos.x < limit[MARGIN_LEFT]) - camera_pos.x -= screen_rect.pos.x - limit[MARGIN_LEFT]; + if (screen_rect.position.x < limit[MARGIN_LEFT]) + camera_pos.x -= screen_rect.position.x - limit[MARGIN_LEFT]; - if (screen_rect.pos.x + screen_rect.size.x > limit[MARGIN_RIGHT]) - camera_pos.x -= screen_rect.pos.x + screen_rect.size.x - limit[MARGIN_RIGHT]; + if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT]) + camera_pos.x -= screen_rect.position.x + screen_rect.size.x - limit[MARGIN_RIGHT]; - if (screen_rect.pos.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) - camera_pos.y -= screen_rect.pos.y + screen_rect.size.y - limit[MARGIN_BOTTOM]; + if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) + camera_pos.y -= screen_rect.position.y + screen_rect.size.y - limit[MARGIN_BOTTOM]; - if (screen_rect.pos.y < limit[MARGIN_TOP]) - camera_pos.y -= screen_rect.pos.y - limit[MARGIN_TOP]; + if (screen_rect.position.y < limit[MARGIN_TOP]) + camera_pos.y -= screen_rect.position.y - limit[MARGIN_TOP]; } if (smoothing_enabled && !get_tree()->is_editor_hint()) { @@ -160,42 +160,42 @@ Transform2D Camera2D::get_camera_transform() { } Rect2 screen_rect(-screen_offset + ret_camera_pos, screen_size * zoom); - if (screen_rect.pos.x < limit[MARGIN_LEFT]) - screen_rect.pos.x = limit[MARGIN_LEFT]; + if (screen_rect.position.x < limit[MARGIN_LEFT]) + screen_rect.position.x = limit[MARGIN_LEFT]; - if (screen_rect.pos.x + screen_rect.size.x > limit[MARGIN_RIGHT]) - screen_rect.pos.x = limit[MARGIN_RIGHT] - screen_rect.size.x; + if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT]) + screen_rect.position.x = limit[MARGIN_RIGHT] - screen_rect.size.x; - if (screen_rect.pos.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) - screen_rect.pos.y = limit[MARGIN_BOTTOM] - screen_rect.size.y; + if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) + screen_rect.position.y = limit[MARGIN_BOTTOM] - screen_rect.size.y; - if (screen_rect.pos.y < limit[MARGIN_TOP]) - screen_rect.pos.y = limit[MARGIN_TOP]; + if (screen_rect.position.y < limit[MARGIN_TOP]) + screen_rect.position.y = limit[MARGIN_TOP]; if (offset != Vector2()) { - screen_rect.pos += offset; - if (screen_rect.pos.x + screen_rect.size.x > limit[MARGIN_RIGHT]) - screen_rect.pos.x = limit[MARGIN_RIGHT] - screen_rect.size.x; + screen_rect.position += offset; + if (screen_rect.position.x + screen_rect.size.x > limit[MARGIN_RIGHT]) + screen_rect.position.x = limit[MARGIN_RIGHT] - screen_rect.size.x; - if (screen_rect.pos.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) - screen_rect.pos.y = limit[MARGIN_BOTTOM] - screen_rect.size.y; + if (screen_rect.position.y + screen_rect.size.y > limit[MARGIN_BOTTOM]) + screen_rect.position.y = limit[MARGIN_BOTTOM] - screen_rect.size.y; - if (screen_rect.pos.x < limit[MARGIN_LEFT]) - screen_rect.pos.x = limit[MARGIN_LEFT]; + if (screen_rect.position.x < limit[MARGIN_LEFT]) + screen_rect.position.x = limit[MARGIN_LEFT]; - if (screen_rect.pos.y < limit[MARGIN_TOP]) - screen_rect.pos.y = limit[MARGIN_TOP]; + if (screen_rect.position.y < limit[MARGIN_TOP]) + screen_rect.position.y = limit[MARGIN_TOP]; } - camera_screen_center = screen_rect.pos + screen_rect.size * 0.5; + camera_screen_center = screen_rect.position + screen_rect.size * 0.5; Transform2D xform; if (rotating) { xform.set_rotation(angle); } xform.scale_basis(zoom); - xform.set_origin(screen_rect.pos /*.floor()*/); + xform.set_origin(screen_rect.position /*.floor()*/); /* if (0) { diff --git a/scene/2d/collision_polygon_2d.cpp b/scene/2d/collision_polygon_2d.cpp index 39eef89274..6b603c6473 100644 --- a/scene/2d/collision_polygon_2d.cpp +++ b/scene/2d/collision_polygon_2d.cpp @@ -233,7 +233,7 @@ void CollisionPolygon2D::set_polygon(const Vector<Point2> &p_polygon) { aabb = Rect2(-10, -10, 20, 20); } else { - aabb.pos -= aabb.size * 0.3; + aabb.position -= aabb.size * 0.3; aabb.size += aabb.size * 0.6; } _update_parent(); diff --git a/scene/2d/line_builder.cpp b/scene/2d/line_builder.cpp index add476ae0f..ea059d133d 100644 --- a/scene/2d/line_builder.cpp +++ b/scene/2d/line_builder.cpp @@ -83,8 +83,8 @@ static inline Vector2 rotate90(const Vector2 &v) { static inline Vector2 interpolate(const Rect2 &r, const Vector2 &v) { return Vector2( - Math::lerp(r.get_pos().x, r.get_pos().x + r.get_size().x, v.x), - Math::lerp(r.get_pos().y, r.get_pos().y + r.get_size().y, v.y)); + Math::lerp(r.position.x, r.position.x + r.get_size().x, v.x), + Math::lerp(r.position.y, r.position.y + r.get_size().y, v.y)); } //---------------------------------------------------------------------------- diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index ec286b1d54..6fe1dd73fe 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -76,9 +76,9 @@ void Node2D::edit_set_rect(const Rect2 &p_edit_rect) { Vector2 zero_offset; if (r.size.x != 0) - zero_offset.x = -r.pos.x / r.size.x; + zero_offset.x = -r.position.x / r.size.x; if (r.size.y != 0) - zero_offset.y = -r.pos.y / r.size.y; + zero_offset.y = -r.position.y / r.size.y; Size2 new_scale(1, 1); @@ -87,7 +87,7 @@ void Node2D::edit_set_rect(const Rect2 &p_edit_rect) { if (r.size.y != 0) new_scale.y = p_edit_rect.size.y / r.size.y; - Point2 new_pos = p_edit_rect.pos + p_edit_rect.size * zero_offset; //p_edit_rect.pos - r.pos; + Point2 new_pos = p_edit_rect.position + p_edit_rect.size * zero_offset; //p_edit_rect.pos - r.pos; Transform2D postxf; postxf.set_rotation_and_scale(angle, _scale); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 951861256e..27d0d07c0f 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -568,8 +568,8 @@ void Particles2D::_notification(int p_what) { if (total_frames > 1) { int frame = Math::fast_ftoi(Math::floor(p.frame * total_frames)) % total_frames; - src_rect.pos.x = size.x * (frame % h_frames); - src_rect.pos.y = size.y * (frame / h_frames); + src_rect.position.x = size.x * (frame % h_frames); + src_rect.position.y = size.y * (frame / h_frames); } Rect2 dst_rect(Point2(), size); if (flip_h) diff --git a/scene/2d/polygon_2d.cpp b/scene/2d/polygon_2d.cpp index cb3e67f895..5c1c953a37 100644 --- a/scene/2d/polygon_2d.cpp +++ b/scene/2d/polygon_2d.cpp @@ -38,7 +38,7 @@ Rect2 Polygon2D::get_item_rect() const { for (int i = 0; i < l; i++) { Vector2 pos = r[i] + offset; if (i == 0) - item_rect.pos = pos; + item_rect.position = pos; else item_rect.expand_to(pos); } @@ -95,7 +95,7 @@ void Polygon2D::_notification(int p_what) { for (int i = 0; i < len; i++) { if (i == 0) - bounds.pos = points[i]; + bounds.position = points[i]; else bounds.expand_to(points[i]); if (points[i].y > highest_y) { @@ -110,10 +110,10 @@ void Polygon2D::_notification(int p_what) { Vector2 ep[7] = { Vector2(points[highest_idx].x, points[highest_idx].y + invert_border), - Vector2(bounds.pos + bounds.size), - Vector2(bounds.pos + Vector2(bounds.size.x, 0)), - Vector2(bounds.pos), - Vector2(bounds.pos + Vector2(0, bounds.size.y)), + Vector2(bounds.position + bounds.size), + Vector2(bounds.position + Vector2(bounds.size.x, 0)), + Vector2(bounds.position), + Vector2(bounds.position + Vector2(0, bounds.size.y)), Vector2(points[highest_idx].x - CMP_EPSILON, points[highest_idx].y + invert_border), Vector2(points[highest_idx].x - CMP_EPSILON, points[highest_idx].y), }; diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 1735bf3b91..c1eb90e52a 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -75,8 +75,8 @@ void Sprite::_notification(int p_what) { s = s / Size2(hframes, vframes); src_rect.size = s; - src_rect.pos.x += float(frame % hframes) * s.x; - src_rect.pos.y += float(frame / hframes) * s.y; + src_rect.position.x += float(frame % hframes) * s.x; + src_rect.position.y += float(frame / hframes) * s.y; } Point2 ofs = offset; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 080276eb25..eebf0efd1e 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -370,14 +370,14 @@ void TileMap::_update_dirty_quadrants() { s = tex->get_size(); else { s = r.size; - r.pos.x += fp_adjust; - r.pos.y += fp_adjust; + r.position.x += fp_adjust; + r.position.y += fp_adjust; r.size.x -= fp_adjust * 2.0; r.size.y -= fp_adjust * 2.0; } Rect2 rect; - rect.pos = offset.floor(); + rect.position = offset.floor(); rect.size = s; if (rect.size.y > rect.size.x) { @@ -406,39 +406,39 @@ void TileMap::_update_dirty_quadrants() { Vector2 center_ofs; if (tile_origin == TILE_ORIGIN_TOP_LEFT) { - rect.pos += tile_ofs; + rect.position += tile_ofs; } else if (tile_origin == TILE_ORIGIN_BOTTOM_LEFT) { - rect.pos += tile_ofs; + rect.position += tile_ofs; if (c.transpose) { if (c.flip_h) - rect.pos.x -= cell_size.x; + rect.position.x -= cell_size.x; else - rect.pos.x += cell_size.x; + rect.position.x += cell_size.x; } else { if (c.flip_v) - rect.pos.y -= cell_size.y; + rect.position.y -= cell_size.y; else - rect.pos.y += cell_size.y; + rect.position.y += cell_size.y; } } else if (tile_origin == TILE_ORIGIN_CENTER) { - rect.pos += tcenter; + rect.position += tcenter; Vector2 center = (s / 2) - tile_ofs; center_ofs = tcenter - (s / 2); if (c.flip_h) - rect.pos.x -= s.x - center.x; + rect.position.x -= s.x - center.x; else - rect.pos.x -= center.x; + rect.position.x -= center.x; if (c.flip_v) - rect.pos.y -= s.y - center.y; + rect.position.y -= s.y - center.y; else - rect.pos.y -= center.y; + rect.position.y -= center.y; } Color modulate = tile_set->tile_get_modulate(c.id); @@ -549,7 +549,7 @@ void TileMap::_recompute_rect_cache() { for (Map<PosKey, Quadrant>::Element *E = quadrant_map.front(); E; E = E->next()) { Rect2 r; - r.pos = _map_to_world(E->key().x * _get_quadrant_size(), E->key().y * _get_quadrant_size()); + r.position = _map_to_world(E->key().x * _get_quadrant_size(), E->key().y * _get_quadrant_size()); r.expand_to(_map_to_world(E->key().x * _get_quadrant_size() + _get_quadrant_size(), E->key().y * _get_quadrant_size())); r.expand_to(_map_to_world(E->key().x * _get_quadrant_size() + _get_quadrant_size(), E->key().y * _get_quadrant_size() + _get_quadrant_size())); r.expand_to(_map_to_world(E->key().x * _get_quadrant_size(), E->key().y * _get_quadrant_size() + _get_quadrant_size())); diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp index e97b22f9e0..43487505c2 100644 --- a/scene/3d/sprite_3d.cpp +++ b/scene/3d/sprite_3d.cpp @@ -335,8 +335,8 @@ void Sprite3D::_draw() { s = s / Size2i(hframes, vframes); src_rect.size = s; - src_rect.pos.x += (frame % hframes) * s.x; - src_rect.pos.y += (frame / hframes) * s.y; + src_rect.position.x += (frame % hframes) * s.x; + src_rect.position.y += (frame / hframes) * s.y; } Point2i ofs = get_offset(); @@ -360,17 +360,17 @@ void Sprite3D::_draw() { Vector2 vertices[4] = { - (final_rect.pos + Vector2(0, final_rect.size.y)) * pixel_size, - (final_rect.pos + final_rect.size) * pixel_size, - (final_rect.pos + Vector2(final_rect.size.x, 0)) * pixel_size, - final_rect.pos * pixel_size, + (final_rect.position + Vector2(0, final_rect.size.y)) * pixel_size, + (final_rect.position + final_rect.size) * pixel_size, + (final_rect.position + Vector2(final_rect.size.x, 0)) * pixel_size, + final_rect.position * pixel_size, }; Vector2 uvs[4] = { - final_src_rect.pos / tsize, - (final_src_rect.pos + Vector2(final_src_rect.size.x, 0)) / tsize, - (final_src_rect.pos + final_src_rect.size) / tsize, - (final_src_rect.pos + Vector2(0, final_src_rect.size.y)) / tsize, + final_src_rect.position / tsize, + (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, + (final_src_rect.position + final_src_rect.size) / tsize, + (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize, }; if (is_flipped_h()) { @@ -861,17 +861,17 @@ void AnimatedSprite3D::_draw() { Vector2 vertices[4] = { - (final_rect.pos + Vector2(0, final_rect.size.y)) * pixel_size, - (final_rect.pos + final_rect.size) * pixel_size, - (final_rect.pos + Vector2(final_rect.size.x, 0)) * pixel_size, - final_rect.pos * pixel_size, + (final_rect.position + Vector2(0, final_rect.size.y)) * pixel_size, + (final_rect.position + final_rect.size) * pixel_size, + (final_rect.position + Vector2(final_rect.size.x, 0)) * pixel_size, + final_rect.position * pixel_size, }; Vector2 uvs[4] = { - final_src_rect.pos / tsize, - (final_src_rect.pos + Vector2(final_src_rect.size.x, 0)) / tsize, - (final_src_rect.pos + final_src_rect.size) / tsize, - (final_src_rect.pos + Vector2(0, final_src_rect.size.y)) / tsize, + final_src_rect.position / tsize, + (final_src_rect.position + Vector2(final_src_rect.size.x, 0)) / tsize, + (final_src_rect.position + final_src_rect.size) / tsize, + (final_src_rect.position + Vector2(0, final_src_rect.size.y)) / tsize, }; if (is_flipped_h()) { diff --git a/scene/gui/button_array.cpp b/scene/gui/button_array.cpp index 670246a200..1616272e66 100644 --- a/scene/gui/button_array.cpp +++ b/scene/gui/button_array.cpp @@ -236,8 +236,8 @@ void ButtonArray::_notification(int p_what) { } Rect2 r; - r.pos[orientation] = ofs; - r.pos[!orientation] = 0; + r.position[orientation] = ofs; + r.position[!orientation] = 0; r.size[orientation] = s; r.size[!orientation] = op_size; @@ -272,10 +272,10 @@ void ButtonArray::_notification(int p_what) { Point2 text_ofs = ((r.size - ssize - sbsize) / 2.0 + Point2(0, f->get_ascent())).floor() + sbofs; if (buttons[i].icon.is_valid()) { - draw_texture(buttons[i].icon, r.pos + Point2(text_ofs.x, Math::floor((r.size.height - buttons[i].icon->get_height()) / 2.0))); + draw_texture(buttons[i].icon, r.position + Point2(text_ofs.x, Math::floor((r.size.height - buttons[i].icon->get_height()) / 2.0))); text_ofs.x += buttons[i].icon->get_width() + icon_sep; } - draw_string(f, text_ofs + r.pos, buttons[i].xl_text, c); + draw_string(f, text_ofs + r.position, buttons[i].xl_text, c); buttons[i]._pos_cache = ofs; buttons[i]._size_cache = s; diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index c428d524a4..92bb5d43a7 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -96,18 +96,18 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) { if (!(p_child->get_h_size_flags() & SIZE_FILL)) { r.size.x = minsize.x; - r.pos.x += Math::floor((p_rect.size.x - minsize.x) / 2); + r.position.x += Math::floor((p_rect.size.x - minsize.x) / 2); } if (!(p_child->get_v_size_flags() & SIZE_FILL)) { r.size.y = minsize.y; - r.pos.y += Math::floor((p_rect.size.y - minsize.y) / 2); + r.position.y += Math::floor((p_rect.size.y - minsize.y) / 2); } for (int i = 0; i < 4; i++) p_child->set_anchor(Margin(i), ANCHOR_BEGIN); - p_child->set_position(r.pos); + p_child->set_position(r.position); p_child->set_size(r.size); p_child->set_rotation(0); p_child->set_scale(Vector2(1, 1)); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 83fa20bee5..ae30acf52e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -58,7 +58,7 @@ void Control::edit_set_state(const Variant &p_state) { Dictionary s = p_state; Rect2 state = s["rect"]; - set_position(state.pos); + set_position(state.position); set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); @@ -94,15 +94,15 @@ void Control::edit_set_rect(const Rect2 &p_edit_rect) { Transform2D postxf; postxf.set_rotation_and_scale(data.rotation, data.scale); - Vector2 new_pos = postxf.xform(p_edit_rect.pos); + Vector2 new_pos = postxf.xform(p_edit_rect.position); Vector2 pos = get_position() + new_pos; Rect2 new_rect = get_rect(); - new_rect.pos = pos.snapped(Vector2(1, 1)); + new_rect.position = pos.snapped(Vector2(1, 1)); new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1)); - set_position(new_rect.pos); + set_position(new_rect.position); set_size(new_rect.size); } @@ -1477,7 +1477,7 @@ Rect2 Control::get_global_rect() const { Rect2 Control::get_window_rect() const { ERR_FAIL_COND_V(!is_inside_tree(), Rect2()); Rect2 gr = get_global_rect(); - gr.pos += get_viewport()->get_visible_rect().pos; + gr.position += get_viewport()->get_visible_rect().position; return gr; } @@ -1949,10 +1949,10 @@ Control *Control::_get_focus_neighbour(Margin p_margin, int p_count) { Transform2D xform = get_global_transform(); Rect2 rect = get_item_rect(); - points[0] = xform.xform(rect.pos); - points[1] = xform.xform(rect.pos + Point2(rect.size.x, 0)); - points[2] = xform.xform(rect.pos + rect.size); - points[3] = xform.xform(rect.pos + Point2(0, rect.size.y)); + points[0] = xform.xform(rect.position); + points[1] = xform.xform(rect.position + Point2(rect.size.x, 0)); + points[2] = xform.xform(rect.position + rect.size); + points[3] = xform.xform(rect.position + Point2(0, rect.size.y)); const Vector2 dir[4] = { Vector2(-1, 0), @@ -2008,10 +2008,10 @@ void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, con Transform2D xform = c->get_global_transform(); Rect2 rect = c->get_item_rect(); - points[0] = xform.xform(rect.pos); - points[1] = xform.xform(rect.pos + Point2(rect.size.x, 0)); - points[2] = xform.xform(rect.pos + rect.size); - points[3] = xform.xform(rect.pos + Point2(0, rect.size.y)); + points[0] = xform.xform(rect.position); + points[1] = xform.xform(rect.position + Point2(rect.size.x, 0)); + points[2] = xform.xform(rect.position + rect.size); + points[3] = xform.xform(rect.position + Point2(0, rect.size.y)); float min = 1e7; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 7b4f9d57f8..60d1350405 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -90,15 +90,15 @@ bool WindowDialog::has_point(const Point2 &p_point) const { // Enlarge upwards for title bar. int title_height = get_constant("title_height", "WindowDialog"); - r.pos.y -= title_height; + r.position.y -= title_height; r.size.y += title_height; // Inflate by the resizable border thickness. if (resizable) { int scaleborder_size = get_constant("scaleborder_size", "WindowDialog"); - r.pos.x -= scaleborder_size; + r.position.x -= scaleborder_size; r.size.width += scaleborder_size * 2; - r.pos.y -= scaleborder_size; + r.position.y -= scaleborder_size; r.size.height += scaleborder_size * 2; } @@ -162,28 +162,28 @@ void WindowDialog::_gui_input(const Ref<InputEvent> &p_event) { Size2 min_size = get_minimum_size(); if (drag_type == DRAG_MOVE) { - rect.pos = global_pos - drag_offset; + rect.position = global_pos - drag_offset; } else { if (drag_type & DRAG_RESIZE_TOP) { - int bottom = rect.pos.y + rect.size.height; + int bottom = rect.position.y + rect.size.height; int max_y = bottom - min_size.height; - rect.pos.y = MIN(global_pos.y - drag_offset.y, max_y); - rect.size.height = bottom - rect.pos.y; + rect.position.y = MIN(global_pos.y - drag_offset.y, max_y); + rect.size.height = bottom - rect.position.y; } else if (drag_type & DRAG_RESIZE_BOTTOM) { - rect.size.height = global_pos.y - rect.pos.y + drag_offset_far.y; + rect.size.height = global_pos.y - rect.position.y + drag_offset_far.y; } if (drag_type & DRAG_RESIZE_LEFT) { - int right = rect.pos.x + rect.size.width; + int right = rect.position.x + rect.size.width; int max_x = right - min_size.width; - rect.pos.x = MIN(global_pos.x - drag_offset.x, max_x); - rect.size.width = right - rect.pos.x; + rect.position.x = MIN(global_pos.x - drag_offset.x, max_x); + rect.size.width = right - rect.position.x; } else if (drag_type & DRAG_RESIZE_RIGHT) { - rect.size.width = global_pos.x - rect.pos.x + drag_offset_far.x; + rect.size.width = global_pos.x - rect.position.x + drag_offset_far.x; } } set_size(rect.size); - set_position(rect.pos); + set_position(rect.position); } } } diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index b4d24d9cdd..8d085d5399 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -168,24 +168,24 @@ void GraphEdit::_update_scroll() { continue; Rect2 r; - r.pos = gn->get_offset() * zoom; + r.position = gn->get_offset() * zoom; r.size = gn->get_size() * zoom; screen = screen.merge(r); } - screen.pos -= get_size(); + screen.position -= get_size(); screen.size += get_size() * 2.0; - h_scroll->set_min(screen.pos.x); - h_scroll->set_max(screen.pos.x + screen.size.x); + h_scroll->set_min(screen.position.x); + h_scroll->set_max(screen.position.x + screen.size.x); h_scroll->set_page(get_size().x); if (h_scroll->get_max() - h_scroll->get_min() <= h_scroll->get_page()) h_scroll->hide(); else h_scroll->show(); - v_scroll->set_min(screen.pos.y); - v_scroll->set_max(screen.pos.y + screen.size.y); + v_scroll->set_min(screen.position.y); + v_scroll->set_max(screen.position.y + screen.size.y); v_scroll->set_page(get_size().y); if (v_scroll->get_max() - v_scroll->get_min() <= v_scroll->get_page()) diff --git a/scene/gui/graph_node.cpp b/scene/gui/graph_node.cpp index 6d49e6251d..b5d059eaf5 100644 --- a/scene/gui/graph_node.cpp +++ b/scene/gui/graph_node.cpp @@ -239,7 +239,7 @@ void GraphNode::_notification(int p_what) { if (show_close) { Vector2 cpos = Point2(w + sb->get_margin(MARGIN_LEFT), -close->get_height() + close_offset); draw_texture(close, cpos); - close_rect.pos = cpos; + close_rect.position = cpos; close_rect.size = close->get_size(); } else { close_rect = Rect2(); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 2cde3d1c5a..371cf929fe 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -857,7 +857,7 @@ void ItemList::_notification(int p_what) { items[i].rect_cache = items[i].min_rect_cache; if (same_column_width) items[i].rect_cache.size.x = max_column_width; - items[i].rect_cache.pos = ofs; + items[i].rect_cache.position = ofs; max_h = MAX(max_h, items[i].rect_cache.size.y); ofs.x += items[i].rect_cache.size.x + hseparation; //print_line("item "+itos(i)+" ofs "+rtos(items[i].rect_cache.size.x)); @@ -906,10 +906,10 @@ void ItemList::_notification(int p_what) { int from = scroll_bar->get_value(); int to = from + scroll_bar->get_page(); - if (r.pos.y < from) { - scroll_bar->set_value(r.pos.y); - } else if (r.pos.y + r.size.y > to) { - scroll_bar->set_value(r.pos.y + r.size.y - (to - from)); + if (r.position.y < from) { + scroll_bar->set_value(r.position.y); + } else if (r.position.y + r.size.y > to) { + scroll_bar->set_value(r.position.y + r.size.y - (to - from)); } } @@ -928,25 +928,25 @@ void ItemList::_notification(int p_what) { continue; if (current_columns == 1) { - rcache.size.width = width - rcache.pos.x; + rcache.size.width = width - rcache.position.x; } Rect2 r = rcache; - r.pos += base_ofs; + r.position += base_ofs; // Use stylebox to dimension potential bg color, even if not selected - r.pos.x -= sbsel->get_margin(MARGIN_LEFT); + r.position.x -= sbsel->get_margin(MARGIN_LEFT); r.size.x += sbsel->get_margin(MARGIN_LEFT) + sbsel->get_margin(MARGIN_RIGHT); - r.pos.y -= sbsel->get_margin(MARGIN_TOP); + r.position.y -= sbsel->get_margin(MARGIN_TOP); r.size.y += sbsel->get_margin(MARGIN_TOP) + sbsel->get_margin(MARGIN_BOTTOM); if (items[i].selected) { draw_style_box(sbsel, r); } if (items[i].custom_bg.a > 0.001) { - r.pos.x += 2; + r.position.x += 2; r.size.x -= 4; - r.pos.y += 2; + r.position.y += 2; r.size.y -= 4; draw_rect(r, items[i].custom_bg); } @@ -965,7 +965,7 @@ void ItemList::_notification(int p_what) { Vector2 icon_ofs; - Point2 pos = items[i].rect_cache.pos + icon_ofs + base_ofs; + Point2 pos = items[i].rect_cache.position + icon_ofs + base_ofs; if (icon_mode == ICON_MODE_TOP) { @@ -985,7 +985,7 @@ void ItemList::_notification(int p_what) { if (fixed_icon_size.x > 0 && fixed_icon_size.y > 0) { Rect2 adj = _adjust_to_max_size(items[i].get_icon_size() * icon_scale, icon_size); - draw_rect.pos += adj.pos; + draw_rect.position += adj.position; draw_rect.size = adj.size; } @@ -1001,7 +1001,7 @@ void ItemList::_notification(int p_what) { if (items[i].tag_icon.is_valid()) { - draw_texture(items[i].tag_icon, items[i].rect_cache.pos + base_ofs); + draw_texture(items[i].tag_icon, items[i].rect_cache.position + base_ofs); } if (items[i].text != "") { @@ -1046,7 +1046,7 @@ void ItemList::_notification(int p_what) { text_ofs.y += font->get_ascent(); text_ofs = text_ofs.floor(); text_ofs += base_ofs; - text_ofs += items[i].rect_cache.pos; + text_ofs += items[i].rect_cache.position; for (int j = 0; j < ss; j++) { @@ -1074,7 +1074,7 @@ void ItemList::_notification(int p_what) { text_ofs.y += font->get_ascent(); text_ofs = text_ofs.floor(); text_ofs += base_ofs; - text_ofs += items[i].rect_cache.pos; + text_ofs += items[i].rect_cache.position; draw_string(font, text_ofs, items[i].text, modulate, max_len + 1); } @@ -1083,7 +1083,7 @@ void ItemList::_notification(int p_what) { if (select_mode == SELECT_MULTI && i == current) { Rect2 r = rcache; - r.pos += base_ofs; + r.position += base_ofs; draw_style_box(cursor, r); } } @@ -1141,7 +1141,7 @@ bool ItemList::is_pos_at_end_of_items(const Point2 &p_pos) const { pos.y += scroll_bar->get_value(); Rect2 endrect = items[items.size() - 1].rect_cache; - return (pos.y > endrect.pos.y + endrect.size.y); + return (pos.y > endrect.position.y + endrect.size.y); } String ItemList::get_tooltip(const Point2 &p_pos) const { diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 655d8ed6f6..8979e0f111 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -170,8 +170,8 @@ void Popup::popup_centered(const Size2 &p_size) { Rect2 rect; rect.size = p_size == Size2() ? get_size() : p_size; - rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_position(rect.pos); + rect.position = ((window_size - rect.size) / 2.0).floor(); + set_position(rect.position); set_size(rect.size); show_modal(exclusive); @@ -193,8 +193,8 @@ void Popup::popup_centered_ratio(float p_screen_ratio) { Rect2 rect; Point2 window_size = get_viewport_rect().size; rect.size = (window_size * p_screen_ratio).floor(); - rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_position(rect.pos); + rect.position = ((window_size - rect.size) / 2.0).floor(); + set_position(rect.position); set_size(rect.size); show_modal(exclusive); @@ -216,7 +216,7 @@ void Popup::popup(const Rect2 &bounds) { // Fit the popup into the optionally provided bounds. if (!bounds.has_no_area()) { - set_position(bounds.pos); + set_position(bounds.position); set_size(bounds.size); } _fix_size(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 0301a99600..c4991700aa 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -190,12 +190,12 @@ void PopupMenu::_activate_submenu(int over) { PopupMenu *pum = pm->cast_to<PopupMenu>(); if (pum) { - pr.pos -= pum->get_global_position(); + pr.position -= pum->get_global_position(); pum->clear_autohide_areas(); - pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y, pr.size.x, items[over]._ofs_cache)); + pum->add_autohide_area(Rect2(pr.position.x, pr.position.y, pr.size.x, items[over]._ofs_cache)); if (over < items.size() - 1) { int from = items[over + 1]._ofs_cache; - pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y + from, pr.size.x, pr.size.y - from)); + pum->add_autohide_area(Rect2(pr.position.x, pr.position.y + from, pr.size.x, pr.size.y - from)); } } } diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 1143bdcde2..bd66cd2745 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -267,14 +267,14 @@ void ScrollBar::_notification(int p_what) { grabber_rect.size.width = get_grabber_size(); grabber_rect.size.height = get_size().height; - grabber_rect.pos.y = 0; - grabber_rect.pos.x = get_grabber_offset() + decr->get_width() + bg->get_margin(MARGIN_LEFT); + grabber_rect.position.y = 0; + grabber_rect.position.x = get_grabber_offset() + decr->get_width() + bg->get_margin(MARGIN_LEFT); } else { grabber_rect.size.width = get_size().width; grabber_rect.size.height = get_grabber_size(); - grabber_rect.pos.y = get_grabber_offset() + decr->get_height() + bg->get_margin(MARGIN_TOP); - grabber_rect.pos.x = 0; + grabber_rect.position.y = get_grabber_offset() + decr->get_height() + bg->get_margin(MARGIN_TOP); + grabber_rect.position.x = 0; } grabber->draw(ci, grabber_rect); diff --git a/scene/gui/scroll_container.cpp b/scene/gui/scroll_container.cpp index 70b4ac47f8..cc1a637d2b 100644 --- a/scene/gui/scroll_container.cpp +++ b/scene/gui/scroll_container.cpp @@ -233,14 +233,14 @@ void ScrollContainer::_notification(int p_what) { Rect2 r = Rect2(-scroll, minsize); if (!scroll_h || (!h_scroll->is_visible_in_tree() && c->get_h_size_flags() & SIZE_EXPAND)) { - r.pos.x = 0; + r.position.x = 0; if (c->get_h_size_flags() & SIZE_EXPAND) r.size.width = MAX(size.width, minsize.width); else r.size.width = minsize.width; } if (!scroll_v || (!v_scroll->is_visible_in_tree() && c->get_v_size_flags() & SIZE_EXPAND)) { - r.pos.y = 0; + r.position.y = 0; r.size.height = size.height; if (c->get_v_size_flags() & SIZE_EXPAND) r.size.height = MAX(size.height, minsize.height); diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 5e60e0a43f..5ebcef3e8d 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -233,7 +233,7 @@ void TabContainer::_notification(int p_what) { Control *control = tabs[i + first_tab_cache]->cast_to<Control>(); String text = control->has_meta("_tab_name") ? String(XL_MESSAGE(String(control->get_meta("_tab_name")))) : String(control->get_name()); - int x_content = tab_rect.pos.x + tab_style->get_margin(MARGIN_LEFT); + int x_content = tab_rect.position.x + tab_style->get_margin(MARGIN_LEFT); int top_margin = tab_style->get_margin(MARGIN_TOP); int y_center = top_margin + (tab_rect.size.y - tab_style->get_minimum_size().y) / 2; diff --git a/scene/gui/tabs.cpp b/scene/gui/tabs.cpp index c5a921bb0a..cdb7965444 100644 --- a/scene/gui/tabs.cpp +++ b/scene/gui/tabs.cpp @@ -340,8 +340,8 @@ void Tabs::_notification(int p_what) { Rect2 rb_rect; rb_rect.size = style->get_minimum_size() + rb->get_size(); - rb_rect.pos.x = w; - rb_rect.pos.y = sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - (rb_rect.size.y)) / 2; + rb_rect.position.x = w; + rb_rect.position.y = sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - (rb_rect.size.y)) / 2; if (rb_hover == i) { if (rb_pressing) @@ -350,7 +350,7 @@ void Tabs::_notification(int p_what) { style->draw(ci, rb_rect); } - rb->draw(ci, Point2i(w + style->get_margin(MARGIN_LEFT), rb_rect.pos.y + style->get_margin(MARGIN_TOP))); + rb->draw(ci, Point2i(w + style->get_margin(MARGIN_LEFT), rb_rect.position.y + style->get_margin(MARGIN_TOP))); w += rb->get_width(); tabs[i].rb_rect = rb_rect; } @@ -364,8 +364,8 @@ void Tabs::_notification(int p_what) { Rect2 cb_rect; cb_rect.size = style->get_minimum_size() + cb->get_size(); - cb_rect.pos.x = w; - cb_rect.pos.y = sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - (cb_rect.size.y)) / 2; + cb_rect.position.x = w; + cb_rect.position.y = sb->get_margin(MARGIN_TOP) + ((sb_rect.size.y - sb_ms.y) - (cb_rect.size.y)) / 2; if (!tabs[i].disabled && cb_hover == i) { if (cb_pressing) @@ -374,7 +374,7 @@ void Tabs::_notification(int p_what) { style->draw(ci, cb_rect); } - cb->draw(ci, Point2i(w + style->get_margin(MARGIN_LEFT), cb_rect.pos.y + style->get_margin(MARGIN_TOP))); + cb->draw(ci, Point2i(w + style->get_margin(MARGIN_LEFT), cb_rect.position.y + style->get_margin(MARGIN_TOP))); w += cb->get_width(); tabs[i].cb_rect = cb_rect; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index e4f63115d4..936a9b77f8 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1069,16 +1069,16 @@ void TextEdit::_notification(int p_what) { int th = h + csb->get_minimum_size().y; if (cursor_pos.y + get_row_height() + th > get_size().height) { - completion_rect.pos.y = cursor_pos.y - th; + completion_rect.position.y = cursor_pos.y - th; } else { - completion_rect.pos.y = cursor_pos.y + get_row_height() + csb->get_offset().y; + completion_rect.position.y = cursor_pos.y + get_row_height() + csb->get_offset().y; completion_below = true; } if (cursor_pos.x - nofs + w + scrollw > get_size().width) { - completion_rect.pos.x = get_size().width - w - scrollw; + completion_rect.position.x = get_size().width - w - scrollw; } else { - completion_rect.pos.x = cursor_pos.x - nofs; + completion_rect.position.x = cursor_pos.x - nofs; } completion_rect.size.width = w + 2; @@ -1086,14 +1086,14 @@ void TextEdit::_notification(int p_what) { if (completion_options.size() <= maxlines) scrollw = 0; - draw_style_box(csb, Rect2(completion_rect.pos - csb->get_offset(), completion_rect.size + csb->get_minimum_size() + Size2(scrollw, 0))); + draw_style_box(csb, Rect2(completion_rect.position - csb->get_offset(), completion_rect.size + csb->get_minimum_size() + Size2(scrollw, 0))); if (cache.completion_background_color.a > 0.01) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.pos, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(completion_rect.position, completion_rect.size + Size2(scrollw, 0)), cache.completion_background_color); } int line_from = CLAMP(completion_index - lines / 2, 0, completion_options.size() - lines); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.pos.x, completion_rect.pos.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); - draw_rect(Rect2(completion_rect.pos, Size2(nofs, completion_rect.size.height)), cache.completion_existing_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(completion_rect.position.x, completion_rect.position.y + (completion_index - line_from) * get_row_height()), Size2(completion_rect.size.width, get_row_height())), cache.completion_selected_color); + draw_rect(Rect2(completion_rect.position, Size2(nofs, completion_rect.size.height)), cache.completion_existing_color); for (int i = 0; i < lines; i++) { @@ -1105,14 +1105,14 @@ void TextEdit::_notification(int p_what) { text_color = color_regions[j].color; } } - draw_string(cache.font, Point2(completion_rect.pos.x, completion_rect.pos.y + i * get_row_height() + cache.font->get_ascent()), completion_options[l], text_color, completion_rect.size.width); + draw_string(cache.font, Point2(completion_rect.position.x, completion_rect.position.y + i * get_row_height() + cache.font->get_ascent()), completion_options[l], text_color, completion_rect.size.width); } if (scrollw) { //draw a small scroll rectangle to show a position in the options float r = maxlines / (float)completion_options.size(); float o = line_from / (float)completion_options.size(); - draw_rect(Rect2(completion_rect.pos.x + completion_rect.size.width, completion_rect.pos.y + o * completion_rect.size.y, scrollw, completion_rect.size.y * r), scrollc); + draw_rect(Rect2(completion_rect.position.x + completion_rect.size.width, completion_rect.position.y + o * completion_rect.size.y, scrollw, completion_rect.size.y * r), scrollc); } completion_line_ofs = line_from; @@ -1468,7 +1468,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->get_button_index() == BUTTON_LEFT) { - completion_index = CLAMP(completion_line_ofs + (mb->get_position().y - completion_rect.pos.y) / get_row_height(), 0, completion_options.size() - 1); + completion_index = CLAMP(completion_line_ofs + (mb->get_position().y - completion_rect.position.y) / get_row_height(), 0, completion_options.size() - 1); completion_current = completion_options[completion_index]; update(); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 397386700e..6ea3ee0015 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -877,8 +877,8 @@ void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, co bmsize.width = p_cell.icon_max_w; } - p_cell.draw_icon(ci, rect.pos + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize); - rect.pos.x += bmsize.x + cache.hseparation; + p_cell.draw_icon(ci, rect.position + Size2i(0, Math::floor((real_t)(rect.size.y - bmsize.y) / 2)), bmsize); + rect.position.x += bmsize.x + cache.hseparation; rect.size.x -= bmsize.x + cache.hseparation; } @@ -893,8 +893,8 @@ void Tree::draw_item_rect(const TreeItem::Cell &p_cell, const Rect2i &p_rect, co if (p_cell.suffix != String()) text += " " + p_cell.suffix; - rect.pos.y += Math::floor((rect.size.y - font->get_height()) / 2.0) + font->get_ascent(); - font->draw(ci, rect.pos, text, p_color, rect.size.x); + rect.position.y += Math::floor((rect.size.y - font->get_height()) / 2.0) + font->get_ascent(); + font->draw(ci, rect.position, text, p_color, rect.size.x); } #if 0 @@ -1007,16 +1007,16 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Rect2i item_rect = Rect2i(Point2i(ofs, p_pos.y) - cache.offset + p_draw_ofs, Size2i(w, label_h)); Rect2i cell_rect = item_rect; if (i != 0) { - cell_rect.pos.x -= cache.hseparation; + cell_rect.position.x -= cache.hseparation; cell_rect.size.x += cache.hseparation; } - VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.pos.x, cell_rect.pos.y + cell_rect.size.height), cell_rect.pos + cell_rect.size, cache.guide_color, 1); + VisualServer::get_singleton()->canvas_item_add_line(ci, Point2i(cell_rect.position.x, cell_rect.position.y + cell_rect.size.height), cell_rect.position + cell_rect.size, cache.guide_color, 1); if (i == 0) { if (p_item->cells[0].selected && select_mode == SELECT_ROW) { - Rect2i row_rect = Rect2i(Point2i(cache.bg->get_margin(MARGIN_LEFT), item_rect.pos.y), Size2i(get_size().width - cache.bg->get_minimum_size().width, item_rect.size.y)); + Rect2i row_rect = Rect2i(Point2i(cache.bg->get_margin(MARGIN_LEFT), item_rect.position.y), Size2i(get_size().width - cache.bg->get_minimum_size().width, item_rect.size.y)); //Rect2 r = Rect2i(row_rect.pos,row_rect.size); //r.grow(cache.selected->get_margin(MARGIN_LEFT)); if (has_focus()) @@ -1028,34 +1028,34 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (p_item->cells[i].selected && select_mode != SELECT_ROW) { - Rect2i r(item_rect.pos, item_rect.size); + Rect2i r(item_rect.position, item_rect.size); if (p_item->cells[i].text.size() > 0) { float icon_width = p_item->cells[i].get_icon_size().width; - r.pos.x += icon_width; + r.position.x += icon_width; r.size.x -= icon_width; } //r.grow(cache.selected->get_margin(MARGIN_LEFT)); if (has_focus()) { cache.selected_focus->draw(ci, r); - p_item->set_meta("__focus_rect", Rect2(r.pos, r.size)); + p_item->set_meta("__focus_rect", Rect2(r.position, r.size)); } else { cache.selected->draw(ci, r); } if (text_editor->is_visible_in_tree()) { - text_editor->set_position(get_global_position() + r.pos); + text_editor->set_position(get_global_position() + r.position); } } if (p_item->cells[i].custom_bg_color) { Rect2 r = cell_rect; - r.pos.x -= cache.hseparation; + r.position.x -= cache.hseparation; r.size.x += cache.hseparation; if (p_item->cells[i].custom_bg_outline) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y, r.size.x, 1), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y + r.size.y - 1, r.size.x, 1), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y, 1, r.size.y), p_item->cells[i].bg_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x + r.size.x - 1, r.pos.y, 1, r.size.y), p_item->cells[i].bg_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), p_item->cells[i].bg_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y - 1, r.size.x, 1), p_item->cells[i].bg_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), p_item->cells[i].bg_color); } else { VisualServer::get_singleton()->canvas_item_add_rect(ci, r, p_item->cells[i].bg_color); } @@ -1066,22 +1066,22 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Rect2 r = cell_rect; if (drop_mode_section == -1 || drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y, r.size.x, 1), cache.drop_position_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), cache.drop_position_color); } if (drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y, 1, r.size.y), cache.drop_position_color); - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x + r.size.x - 1, r.pos.y, 1, r.size.y), cache.drop_position_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, 1, r.size.y), cache.drop_position_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x + r.size.x - 1, r.position.y, 1, r.size.y), cache.drop_position_color); } if (drop_mode_section == 1 || drop_mode_section == 0) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.pos.x, r.pos.y + r.size.y, r.size.x, 1), cache.drop_position_color); + VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y, r.size.x, 1), cache.drop_position_color); } } Color col = p_item->cells[i].custom_color ? p_item->cells[i].color : get_color(p_item->cells[i].selected ? "font_color_selected" : "font_color"); - Point2i text_pos = item_rect.pos; + Point2i text_pos = item_rect.position; text_pos.y += Math::floor((item_rect.size.y - font->get_height()) / 2) + font_ascent; switch (p_item->cells[i].mode) { @@ -1094,7 +1094,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 Ref<Texture> checked = cache.checked; Ref<Texture> unchecked = cache.unchecked; - Point2i check_ofs = item_rect.pos; + Point2i check_ofs = item_rect.position; check_ofs.y += Math::floor((real_t)(item_rect.size.y - checked->get_height()) / 2); if (p_item->cells[i].checked) { @@ -1109,7 +1109,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 text_pos.x += check_w; item_rect.size.x -= check_w; - item_rect.pos.x += check_w; + item_rect.position.x += check_w; draw_item_rect(p_item->cells[i], item_rect, col); @@ -1137,7 +1137,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 font->draw(ci, text_pos, s, col, item_rect.size.x - downarrow->get_width()); //? - Point2i arrow_pos = item_rect.pos; + Point2i arrow_pos = item_rect.position; arrow_pos.x += item_rect.size.x - downarrow->get_width(); arrow_pos.y += Math::floor(((item_rect.size.y - downarrow->get_height())) / 2.0); @@ -1157,7 +1157,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (!p_item->cells[i].editable) break; - Point2i updown_pos = item_rect.pos; + Point2i updown_pos = item_rect.position; updown_pos.x += item_rect.size.x - updown->get_width(); updown_pos.y += Math::floor(((item_rect.size.y - updown->get_height())) / 2.0); @@ -1176,7 +1176,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } Point2i icon_ofs = (item_rect.size - icon_size) / 2; - icon_ofs += item_rect.pos; + icon_ofs += item_rect.position; draw_texture_rect(p_item->cells[i].icon, Rect2(icon_ofs, icon_size)); //p_item->cells[i].icon->draw(ci, icon_ofs); @@ -1205,7 +1205,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 ir.size.width -= downarrow->get_width(); draw_item_rect(p_item->cells[i], ir, col); - Point2i arrow_pos = item_rect.pos; + Point2i arrow_pos = item_rect.position; arrow_pos.x += item_rect.size.x - downarrow->get_width(); arrow_pos.y += Math::floor(((item_rect.size.y - downarrow->get_height())) / 2.0); @@ -2401,7 +2401,7 @@ bool Tree::edit_selected() { edited_item = s; edited_col = col; - custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size); + custom_popup_rect = Rect2i(get_global_position() + rect.position, rect.size); emit_signal("custom_popup_edited", false); item_edited(col, s); @@ -2416,7 +2416,7 @@ bool Tree::edit_selected() { } popup_menu->set_size(Size2(rect.size.width, 0)); - popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height)); + popup_menu->set_position(get_global_position() + rect.position + Point2i(0, rect.size.height)); popup_menu->popup(); popup_edited_item = s; popup_edited_item_col = col; @@ -2424,7 +2424,7 @@ bool Tree::edit_selected() { } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - Point2i textedpos = get_global_position() + rect.pos; + Point2i textedpos = get_global_position() + rect.position; text_editor->set_position(textedpos); text_editor->set_size(rect.size); text_editor->clear(); @@ -2671,7 +2671,7 @@ void Tree::_notification(int p_what) { ofs += tbrect.size.width; //text int clip_w = tbrect.size.width - sb->get_minimum_size().width; - f->draw_halign(ci, tbrect.pos + Point2i(sb->get_offset().x, (tbrect.size.height - f->get_height()) / 2 + f->get_ascent()), HALIGN_CENTER, clip_w, columns[i].title, cache.title_button_color); + f->draw_halign(ci, tbrect.position + Point2i(sb->get_offset().x, (tbrect.size.height - f->get_height()) / 2 + f->get_ascent()), HALIGN_CENTER, clip_w, columns[i].title, cache.title_button_color); } } } @@ -3053,11 +3053,11 @@ Rect2 Tree::get_item_rect(TreeItem *p_item, int p_column) const { int ofs = get_item_offset(p_item); int height = compute_item_height(p_item); Rect2 r; - r.pos.y = ofs; + r.position.y = ofs; r.size.height = height; if (p_column == -1) { - r.pos.x = 0; + r.position.x = 0; r.size.x = get_size().width; } else { @@ -3065,7 +3065,7 @@ Rect2 Tree::get_item_rect(TreeItem *p_item, int p_column) const { for (int i = 0; i < p_column; i++) { accum += get_column_width(i); } - r.pos.x = accum; + r.position.x = accum; r.size.x = get_column_width(p_column); } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a1d90c143e..ec36cf48bc 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1310,7 +1310,7 @@ Transform2D Viewport::_get_input_pre_xform() const { if (to_screen_rect != Rect2()) { - pre_xf.elements[2] = -to_screen_rect.pos; + pre_xf.elements[2] = -to_screen_rect.position; pre_xf.scale(size / to_screen_rect.size); } @@ -1473,17 +1473,17 @@ void Viewport::_gui_show_tooltip() { gui.tooltip_label->set_text(tooltip); Rect2 r(gui.tooltip_pos + Point2(10, 10), gui.tooltip_label->get_combined_minimum_size() + ttp->get_minimum_size()); Rect2 vr = gui.tooltip_label->get_viewport_rect(); - if (r.size.x + r.pos.x > vr.size.x) - r.pos.x = vr.size.x - r.size.x; - else if (r.pos.x < 0) - r.pos.x = 0; + if (r.size.x + r.position.x > vr.size.x) + r.position.x = vr.size.x - r.size.x; + else if (r.position.x < 0) + r.position.x = 0; - if (r.size.y + r.pos.y > vr.size.y) - r.pos.y = vr.size.y - r.size.y; - else if (r.pos.y < 0) - r.pos.y = 0; + if (r.size.y + r.position.y > vr.size.y) + r.position.y = vr.size.y - r.size.y; + else if (r.position.y < 0) + r.position.y = 0; - gui.tooltip_popup->set_global_position(r.pos); + gui.tooltip_popup->set_global_position(r.position); gui.tooltip_popup->set_size(r.size); gui.tooltip_popup->raise(); diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 545c700354..fe5e6e775a 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -1133,7 +1133,7 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a Rect2 pb = p_post_b; return Rect2( - a.pos.cubic_interpolate(b.pos, pa.pos, pb.pos, p_c), + a.position.cubic_interpolate(b.position, pa.position, pb.position, p_c), a.size.cubic_interpolate(b.size, pa.size, pb.size, p_c)); } break; diff --git a/scene/resources/bit_mask.cpp b/scene/resources/bit_mask.cpp index e512f8a968..a473067937 100644 --- a/scene/resources/bit_mask.cpp +++ b/scene/resources/bit_mask.cpp @@ -67,9 +67,9 @@ void BitMap::set_bit_rect(const Rect2 &p_rect, bool p_value) { Rect2i current = Rect2i(0, 0, width, height).clip(p_rect); uint8_t *data = bitmask.ptr(); - for (int i = current.pos.x; i < current.pos.x + current.size.x; i++) { + for (int i = current.position.x; i < current.position.x + current.size.x; i++) { - for (int j = current.pos.y; j < current.pos.y + current.size.y; j++) { + for (int j = current.position.y; j < current.position.y + current.size.y; j++) { int ofs = width * j + i; int bbyte = ofs / 8; diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp index 3f41526bcb..20177692a1 100644 --- a/scene/resources/capsule_shape_2d.cpp +++ b/scene/resources/capsule_shape_2d.cpp @@ -80,7 +80,7 @@ Rect2 CapsuleShape2D::get_rect() const { Vector2 he = Point2(get_radius(), get_radius() + get_height() * 0.5); Rect2 rect; - rect.pos = -he; + rect.position = -he; rect.size = he * 2.0; return rect; } diff --git a/scene/resources/circle_shape_2d.cpp b/scene/resources/circle_shape_2d.cpp index 4512e1c4a9..1b7e09ddfb 100644 --- a/scene/resources/circle_shape_2d.cpp +++ b/scene/resources/circle_shape_2d.cpp @@ -58,7 +58,7 @@ void CircleShape2D::_bind_methods() { Rect2 CircleShape2D::get_rect() const { Rect2 rect; - rect.pos = -Point2(get_radius(), get_radius()); + rect.position = -Point2(get_radius(), get_radius()); rect.size = Point2(get_radius(), get_radius()) * 2.0; return rect; } diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp index 653540a663..b8c931421e 100644 --- a/scene/resources/concave_polygon_shape_2d.cpp +++ b/scene/resources/concave_polygon_shape_2d.cpp @@ -68,7 +68,7 @@ Rect2 ConcavePolygonShape2D::get_rect() const { PoolVector<Vector2>::Read r = s.read(); for (int i = 0; i < len; i++) { if (i == 0) - rect.pos = r[i]; + rect.position = r[i]; else rect.expand_to(r[i]); } diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index fcbf66c8cd..e13f7faf70 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -78,7 +78,7 @@ Rect2 ConvexPolygonShape2D::get_rect() const { Rect2 rect; for (int i = 0; i < points.size(); i++) { if (i == 0) - rect.pos = points[i]; + rect.position = points[i]; else rect.expand_to(points[i]); } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 7e5065a03b..fa2418f6bf 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -138,8 +138,8 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p int chr = c[0]; Rect2 frect; - frect.pos.x = c[1]; - frect.pos.y = c[2]; + frect.position.x = c[1]; + frect.position.y = c[2]; frect.size.x = c[3]; frect.size.y = c[4]; Point2 align(c[5], c[6] + p_valign); @@ -170,8 +170,8 @@ static Ref<BitmapFont> make_font2(int p_height, int p_ascent, int p_charcount, c int chr = c[0]; Rect2 frect; - frect.pos.x = c[1]; - frect.pos.y = c[2]; + frect.position.x = c[1]; + frect.position.y = c[2]; frect.size.x = c[3]; frect.size.y = c[4]; Point2 align(c[6], c[5]); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 692dc47677..225a42f651 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -120,8 +120,8 @@ PoolVector<int> BitmapFont::_get_chars() const { const Character *c = char_map.getptr(*key); chars.push_back(*key); chars.push_back(c->texture_idx); - chars.push_back(c->rect.pos.x); - chars.push_back(c->rect.pos.y); + chars.push_back(c->rect.position.x); + chars.push_back(c->rect.position.y); chars.push_back(c->rect.size.x); chars.push_back(c->rect.size.y); @@ -272,9 +272,9 @@ Error BitmapFont::create_from_fnt(const String &p_string) { Rect2 rect; if (keys.has("x")) - rect.pos.x = keys["x"].to_int(); + rect.position.x = keys["x"].to_int(); if (keys.has("y")) - rect.pos.y = keys["y"].to_int(); + rect.position.y = keys["y"].to_int(); if (keys.has("width")) rect.size.width = keys["width"].to_int(); if (keys.has("height")) diff --git a/scene/resources/polygon_path_finder.cpp b/scene/resources/polygon_path_finder.cpp index 472031366f..80b413630a 100644 --- a/scene/resources/polygon_path_finder.cpp +++ b/scene/resources/polygon_path_finder.cpp @@ -71,7 +71,7 @@ void PolygonPathFinder::setup(const Vector<Vector2> &p_points, const Vector<int> outside_point.y = i == 0 ? p_points[0].y : (MAX(p_points[i].y, outside_point.y)); if (i == 0) { - bounds.pos = points[i].pos; + bounds.position = points[i].pos; } else { bounds.expand_to(points[i].pos); } diff --git a/scene/resources/segment_shape_2d.cpp b/scene/resources/segment_shape_2d.cpp index 145374ff05..99062d693b 100644 --- a/scene/resources/segment_shape_2d.cpp +++ b/scene/resources/segment_shape_2d.cpp @@ -35,7 +35,7 @@ void SegmentShape2D::_update_shape() { Rect2 r; - r.pos = a; + r.position = a; r.size = b; Physics2DServer::get_singleton()->shape_set_data(get_rid(), r); emit_changed(); @@ -69,7 +69,7 @@ void SegmentShape2D::draw(const RID &p_to_rid, const Color &p_color) { Rect2 SegmentShape2D::get_rect() const { Rect2 rect; - rect.pos = a; + rect.position = a; rect.expand_to(b); return rect; } @@ -121,7 +121,7 @@ void RayShape2D::draw(const RID &p_to_rid, const Color &p_color) { Rect2 RayShape2D::get_rect() const { Rect2 rect; - rect.pos = Vector2(); + rect.position = Vector2(); rect.expand_to(Vector2(0, length)); rect = rect.grow(0.707 * 4); return rect; diff --git a/scene/resources/shape_line_2d.cpp b/scene/resources/shape_line_2d.cpp index 89c1cea252..c38ae04eff 100644 --- a/scene/resources/shape_line_2d.cpp +++ b/scene/resources/shape_line_2d.cpp @@ -76,7 +76,7 @@ Rect2 LineShape2D::get_rect() const { Vector2 l1[2] = { point - get_normal().tangent() * 100, point + get_normal().tangent() * 100 }; Vector2 l2[2] = { point, point + get_normal() * 30 }; Rect2 rect; - rect.pos = l1[0]; + rect.position = l1[0]; rect.expand_to(l1[1]); rect.expand_to(l2[0]); rect.expand_to(l2[1]); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index b665de2de1..8874cbc102 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -138,8 +138,8 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { texture->get_rect_region(rect, src_rect, rect, src_rect); - rect.pos.x -= expand_margin[MARGIN_LEFT]; - rect.pos.y -= expand_margin[MARGIN_TOP]; + rect.position.x -= expand_margin[MARGIN_LEFT]; + rect.position.y -= expand_margin[MARGIN_TOP]; rect.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT]; rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM]; @@ -352,26 +352,26 @@ void StyleBoxFlat::draw(RID p_canvas_item, const Rect2 &p_rect) const { color_downright.b = (border_size - i) * color_downright.b / border_size + i * bg_color.b / border_size; } - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.pos.x, r.pos.y + r.size.y - 1), Size2(r.size.x, 1)), color_downright); - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.pos.x + r.size.x - 1, r.pos.y), Size2(1, r.size.y)), color_downright); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x, r.position.y + r.size.y - 1), Size2(r.size.x, 1)), color_downright); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r.position.x + r.size.x - 1, r.position.y), Size2(1, r.size.y)), color_downright); - vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, Size2(r.size.x, 1)), color_upleft); - vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, Size2(1, r.size.y)), color_upleft); + vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(r.size.x, 1)), color_upleft); + vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, Size2(1, r.size.y)), color_upleft); - r.pos.x++; - r.pos.y++; + r.position.x++; + r.position.y++; r.size.x -= 2; r.size.y -= 2; } if (draw_center) - vs->canvas_item_add_rect(p_canvas_item, Rect2(r.pos, r.size), bg_color); + vs->canvas_item_add_rect(p_canvas_item, Rect2(r.position, r.size), bg_color); Rect2i r_add = p_rect; - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y - additional_border_size[MARGIN_TOP]), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_TOP])), light_color); - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y), Size2(additional_border_size[MARGIN_LEFT], r_add.size.height)), light_color); - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x + r_add.size.width, r_add.pos.y), Size2(additional_border_size[MARGIN_RIGHT], r_add.size.height)), dark_color); - vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.pos.x - additional_border_size[MARGIN_LEFT], r_add.pos.y + r_add.size.height), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_BOTTOM])), dark_color); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y - additional_border_size[MARGIN_TOP]), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_TOP])), light_color); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y), Size2(additional_border_size[MARGIN_LEFT], r_add.size.height)), light_color); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x + r_add.size.width, r_add.position.y), Size2(additional_border_size[MARGIN_RIGHT], r_add.size.height)), dark_color); + vs->canvas_item_add_rect(p_canvas_item, Rect2(Point2i(r_add.position.x - additional_border_size[MARGIN_LEFT], r_add.position.y + r_add.size.height), Size2(r_add.size.width + additional_border_size[MARGIN_LEFT] + additional_border_size[MARGIN_RIGHT], additional_border_size[MARGIN_BOTTOM])), dark_color); } float StyleBoxFlat::get_style_margin(Margin p_margin) const { diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp index 68a11b821d..a1e0c95dd9 100644 --- a/scene/resources/texture.cpp +++ b/scene/resources/texture.cpp @@ -860,7 +860,7 @@ void AtlasTexture::draw(RID p_canvas_item, const Point2 &p_pos, const Color &p_m rc.size.height = atlas->get_height(); } - VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.pos, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose); + VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, Rect2(p_pos + margin.position, rc.size), atlas->get_rid(), rc, p_modulate, p_transpose); } void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile, const Color &p_modulate, bool p_transpose) const { @@ -879,7 +879,7 @@ void AtlasTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile } Vector2 scale = p_rect.size / (region.size + margin.size); - Rect2 dr(p_rect.pos + margin.pos * scale, rc.size * scale); + Rect2 dr(p_rect.position + margin.position * scale, rc.size * scale); VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), rc, p_modulate, p_transpose); } @@ -892,24 +892,24 @@ void AtlasTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons return; Rect2 src = p_src_rect; - src.pos += (rc.pos - margin.pos); + src.position += (rc.position - margin.position); Rect2 src_c = rc.clip(src); if (src_c.size == Size2()) return; - Vector2 ofs = (src_c.pos - src.pos); + Vector2 ofs = (src_c.position - src.position); Vector2 scale = p_rect.size / p_src_rect.size; if (scale.x < 0) { - float mx = (margin.size.width - margin.pos.x); - mx -= margin.pos.x; + float mx = (margin.size.width - margin.position.x); + mx -= margin.position.x; ofs.x = -(ofs.x + mx); } if (scale.y < 0) { - float my = margin.size.height - margin.pos.y; - my -= margin.pos.y; + float my = margin.size.height - margin.position.y; + my -= margin.position.y; ofs.y = -(ofs.y + my); } - Rect2 dr(p_rect.pos + ofs * scale, src_c.size * scale); + Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale); VS::get_singleton()->canvas_item_add_texture_rect_region(p_canvas_item, dr, atlas->get_rid(), src_c, p_modulate, p_transpose); } @@ -922,24 +922,24 @@ bool AtlasTexture::get_rect_region(const Rect2 &p_rect, const Rect2 &p_src_rect, return false; Rect2 src = p_src_rect; - src.pos += (rc.pos - margin.pos); + src.position += (rc.position - margin.position); Rect2 src_c = rc.clip(src); if (src_c.size == Size2()) return false; - Vector2 ofs = (src_c.pos - src.pos); + Vector2 ofs = (src_c.position - src.position); Vector2 scale = p_rect.size / p_src_rect.size; if (scale.x < 0) { - float mx = (margin.size.width - margin.pos.x); - mx -= margin.pos.x; + float mx = (margin.size.width - margin.position.x); + mx -= margin.position.x; ofs.x = -(ofs.x + mx); } if (scale.y < 0) { - float my = margin.size.height - margin.pos.y; - my -= margin.pos.y; + float my = margin.size.height - margin.position.y; + my -= margin.position.y; ofs.y = -(ofs.y + my); } - Rect2 dr(p_rect.pos + ofs * scale, src_c.size * scale); + Rect2 dr(p_rect.position + ofs * scale, src_c.size * scale); r_rect = dr; r_src_rect = src_c; @@ -1096,7 +1096,7 @@ void LargeTexture::draw_rect(RID p_canvas_item, const Rect2 &p_rect, bool p_tile for (int i = 0; i < pieces.size(); i++) { // TODO - pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.pos, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose); + pieces[i].texture->draw_rect(p_canvas_item, Rect2(pieces[i].offset * scale + p_rect.position, pieces[i].texture->get_size() * scale), false, p_modulate, p_transpose); } } void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose) const { @@ -1116,8 +1116,8 @@ void LargeTexture::draw_rect_region(RID p_canvas_item, const Rect2 &p_rect, cons Rect2 local = p_src_rect.clip(rect); Rect2 target = local; target.size *= scale; - target.pos = p_rect.pos + (p_src_rect.pos + rect.pos) * scale; - local.pos -= rect.pos; + target.position = p_rect.position + (p_src_rect.position + rect.position) * scale; + local.position -= rect.position; pieces[i].texture->draw_rect_region(p_canvas_item, target, local, p_modulate, p_transpose); } } diff --git a/scene/resources/world_2d.cpp b/scene/resources/world_2d.cpp index db72ccd03c..ec9ec96e50 100644 --- a/scene/resources/world_2d.cpp +++ b/scene/resources/world_2d.cpp @@ -97,9 +97,9 @@ struct SpatialIndexer2D { void _notifier_update_cells(VisibilityNotifier2D *p_notifier, const Rect2 &p_rect, bool p_add) { - Point2i begin = p_rect.pos; + Point2i begin = p_rect.position; begin /= cell_size; - Point2i end = p_rect.pos + p_rect.size; + Point2i end = p_rect.position + p_rect.size; end /= cell_size; for (int i = begin.x; i <= end.x; i++) { @@ -220,9 +220,9 @@ struct SpatialIndexer2D { for (Map<Viewport *, ViewportData>::Element *E = viewports.front(); E; E = E->next()) { - Point2i begin = E->get().rect.pos; + Point2i begin = E->get().rect.position; begin /= cell_size; - Point2i end = E->get().rect.pos + E->get().rect.size; + Point2i end = E->get().rect.position + E->get().rect.size; end /= cell_size; pass++; List<VisibilityNotifier2D *> added; |