summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-11-13 21:28:08 +0100
committerGitHub <noreply@github.com>2018-11-13 21:28:08 +0100
commit5613aa489e754db3645dfe1215572b78be7e8bd4 (patch)
tree5f71ff20b6158359e23a11d3bba005045ff765df
parentdf5829e93757c3b0639b9ea000816795119b4d9e (diff)
parent3d07a1c10f8965938a503060b24f15f73dcebb45 (diff)
Merge pull request #23299 from FlamyAT/sprite3d-floating-offset
Changed Sprite3D to float based drawing
-rw-r--r--scene/3d/sprite_3d.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/scene/3d/sprite_3d.cpp b/scene/3d/sprite_3d.cpp
index c6717b36ec..8e00fbe735 100644
--- a/scene/3d/sprite_3d.cpp
+++ b/scene/3d/sprite_3d.cpp
@@ -388,7 +388,7 @@ void Sprite3D::_draw() {
return;
Size2i s;
- Rect2i src_rect;
+ Rect2 src_rect;
if (region) {
@@ -396,18 +396,18 @@ void Sprite3D::_draw() {
src_rect = region_rect;
} else {
s = texture->get_size();
- s = s / Size2i(hframes, vframes);
+ s = s / Size2(hframes, vframes);
src_rect.size = s;
src_rect.position.x += (frame % hframes) * s.x;
src_rect.position.y += (frame / hframes) * s.y;
}
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
- Rect2i dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, s);
Rect2 final_rect;
Rect2 final_src_rect;
@@ -612,7 +612,7 @@ Rect2 Sprite3D::get_item_rect() const {
s = s / Point2(hframes, vframes);
}
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
@@ -699,15 +699,15 @@ void AnimatedSprite3D::_draw() {
return;
Size2i s = tsize;
- Rect2i src_rect;
+ Rect2 src_rect;
src_rect.size = s;
- Point2i ofs = get_offset();
+ Point2 ofs = get_offset();
if (is_centered())
ofs -= s / 2;
- Rect2i dst_rect(ofs, s);
+ Rect2 dst_rect(ofs, s);
Rect2 final_rect;
Rect2 final_src_rect;