Simplified texture flip and added comments

This commit is contained in:
raysan5
2016-04-07 13:31:53 +02:00
parent 4b51248372
commit aa22d97983
4 changed files with 13 additions and 5 deletions

View File

@@ -1385,6 +1385,10 @@ void DrawTextureEx(Texture2D texture, Vector2 position, float rotation, float sc
void DrawTextureRec(Texture2D texture, Rectangle sourceRec, Vector2 position, Color tint)
{
Rectangle destRec = { (int)position.x, (int)position.y, abs(sourceRec.width), abs(sourceRec.height) };
if (sourceRec.width < 0) sourceRec.x -= sourceRec.width;
if (sourceRec.height < 0) sourceRec.y -= sourceRec.height;
Vector2 origin = { 0, 0 };
DrawTexturePro(texture, sourceRec, destRec, origin, 0.0f, tint);