Graphics/Sprite: Fix SetTextureRect

This commit is contained in:
Jérôme Leclercq 2022-12-14 09:53:23 +01:00 committed by GitHub
parent 8b101114d1
commit 0537be3201
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -83,8 +83,8 @@ namespace Nz
inline void Sprite::SetTextureRect(const Rectf& textureRect)
{
Vector2ui textureSize(GetTextureSize());
return SetTextureCoords(textureRect / Vector2f(textureSize));
Vector2f invTextureSize = 1.f / Vector2f(Vector2ui(GetTextureSize()));
return SetTextureCoords(Rectf(textureRect.x * invTextureSize.x, textureRect.y * invTextureSize.y, textureRect.width * invTextureSize.x, textureRect.height * invTextureSize.y));
}
inline void Sprite::UpdateVertices()