Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
πŸ› Fix RogueSprite's tk2d UVs
Browse files Browse the repository at this point in the history
  • Loading branch information
Chasmical committed May 19, 2022
1 parent c17666d commit 19a33e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions RogueLibsCore/Sprites/RogueSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ public static tk2dSpriteDefinition CreateDefinition(Texture2D texture, Rect? reg
Vector2 spriteCenter = spriteRegion.center;

Vector2 epsilon = new Vector2(0.001f, 0.001f);
Vector2 upperRightUv = new Vector2(spriteRegion.xMax + epsilon.x, y - (spriteRegion.yMin - epsilon.y)) / new Vector2(x, y);
Vector2 lowerLeftUv = new Vector2(spriteRegion.xMin - epsilon.x, y - (spriteRegion.yMax + epsilon.y)) / new Vector2(x, y);
Vector2 upperRightUv = new Vector2(spriteRegion.xMax + epsilon.x, spriteRegion.yMax + epsilon.y) / new Vector2(x, y);
Vector2 lowerLeftUv = new Vector2(spriteRegion.xMin - epsilon.x, spriteRegion.yMin - epsilon.y) / new Vector2(x, y);

Vector3 b = new Vector3(-spriteCenter.x, spriteCenter.y - spriteRegion.height, 0f) * scale;
Vector3 a = new Vector3(spriteRegion.width - spriteCenter.x, spriteCenter.y, 0f) * scale;
Expand Down

0 comments on commit 19a33e2

Please sign in to comment.