Merge pull request #770 from romulox-x/sprite-frame-float
Modified sprite's draw notification call to use floats instead of intege...
This commit is contained in:
commit
43491a8433
1 changed files with 7 additions and 7 deletions
|
@ -64,20 +64,20 @@ void Sprite::_notification(int p_what) {
|
||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Size2i s;
|
Size2 s;
|
||||||
Rect2i src_rect;
|
Rect2 src_rect;
|
||||||
|
|
||||||
if (region) {
|
if (region) {
|
||||||
|
|
||||||
s=region_rect.size;
|
s=region_rect.size;
|
||||||
src_rect=region_rect;
|
src_rect=region_rect;
|
||||||
} else {
|
} else {
|
||||||
s = texture->get_size();
|
s = Size2(texture->get_size());
|
||||||
s=s/Size2i(hframes,vframes);
|
s=s/Size2(hframes,vframes);
|
||||||
|
|
||||||
src_rect.size=s;
|
src_rect.size=s;
|
||||||
src_rect.pos.x+=(frame%hframes)*s.x;
|
src_rect.pos.x+=float(frame%hframes)*s.x;
|
||||||
src_rect.pos.y+=(frame/hframes)*s.y;
|
src_rect.pos.y+=float(frame/hframes)*s.y;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void Sprite::_notification(int p_what) {
|
||||||
if (centered)
|
if (centered)
|
||||||
ofs-=s/2;
|
ofs-=s/2;
|
||||||
|
|
||||||
Rect2i dst_rect(ofs,s);
|
Rect2 dst_rect(ofs,s);
|
||||||
|
|
||||||
if (hflip)
|
if (hflip)
|
||||||
dst_rect.size.x=-dst_rect.size.x;
|
dst_rect.size.x=-dst_rect.size.x;
|
||||||
|
|
Loading…
Reference in a new issue