diff options
| author | raysan5 <raysan5@gmail.com> | 2016-04-07 13:31:53 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-04-07 13:31:53 +0200 |
| commit | aa22d979834eeddb849f45bba7c0f467b575e6db (patch) | |
| tree | 50d1c417b2a2294e05e4d4ae638f7f4f4d923968 /src/textures.c | |
| parent | 4b51248372302bd9f1baf2452b389f57f0173d59 (diff) | |
| download | raylib-aa22d979834eeddb849f45bba7c0f467b575e6db.tar.gz raylib-aa22d979834eeddb849f45bba7c0f467b575e6db.zip | |
Simplified texture flip and added comments
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/textures.c b/src/textures.c index 67264afb..79047ab7 100644 --- a/src/textures.c +++ b/src/textures.c @@ -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); |
