diff options
author | romulox_x <romulox_x@yahoo.com> | 2014-10-09 19:34:27 -0700 |
---|---|---|
committer | romulox_x <romulox_x@yahoo.com> | 2014-10-09 19:34:27 -0700 |
commit | 5cb403747ea102de5233619263b2162224214947 (patch) | |
tree | c996dc793675778d6e484bf00e988055e6b0e6f2 /scene/2d | |
parent | ede3a4dd3546d3d9d9de5570e2d68dfdf8139bab (diff) |
Modified sprite's draw notification call to use floats instead of integers so that the texture coordinates used to draw a frame from the sprite sheet don't have to snap to pixels
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/sprite.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scene/2d/sprite.cpp b/scene/2d/sprite.cpp index 7d033ed87f..8c3bbfdfc9 100644 --- a/scene/2d/sprite.cpp +++ b/scene/2d/sprite.cpp @@ -64,20 +64,20 @@ void Sprite::_notification(int p_what) { break; */ - Size2i s; - Rect2i src_rect; + Size2 s; + Rect2 src_rect; if (region) { s=region_rect.size; src_rect=region_rect; } else { - s = texture->get_size(); - s=s/Size2i(hframes,vframes); + s = Size2(texture->get_size()); + s=s/Size2(hframes,vframes); src_rect.size=s; - src_rect.pos.x+=(frame%hframes)*s.x; - src_rect.pos.y+=(frame/hframes)*s.y; + src_rect.pos.x+=float(frame%hframes)*s.x; + src_rect.pos.y+=float(frame/hframes)*s.y; } @@ -85,7 +85,7 @@ void Sprite::_notification(int p_what) { if (centered) ofs-=s/2; - Rect2i dst_rect(ofs,s); + Rect2 dst_rect(ofs,s); if (hflip) dst_rect.size.x=-dst_rect.size.x; |