From b132da0ac2b0777cc965238fc3b011b1fa9b1fe5 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 10 Apr 2020 19:10:15 +0200 Subject: [PATCH] WARNING: API BREAK: Reviewed ImageDrawText*() params order To unify with DrawText*() equivalent functions --- src/raylib.h | 4 ++-- src/textures.c | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/raylib.h b/src/raylib.h index d2dc8a54..ba6f23fc 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1168,8 +1168,8 @@ RLAPI void ImageDrawRectangleV(Image *dst, Vector2 position, Vector2 size, Color RLAPI void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color); // Draw rectangle within an image RLAPI void ImageDrawRectangleLines(Image *dst, Rectangle rec, int thick, Color color); // Draw rectangle lines within an image RLAPI void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color tint); // Draw a source image within a destination image (tint applied to source) -RLAPI void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color); // Draw text (default font) within an image (destination) -RLAPI void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color); // Draw text (custom sprite font) within an image (destination) +RLAPI void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font) within an image (destination) +RLAPI void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // Draw text (custom sprite font) within an image (destination) // Texture loading functions // NOTE: These functions require GPU access diff --git a/src/textures.c b/src/textures.c index 15701dda..7c7ffc02 100644 --- a/src/textures.c +++ b/src/textures.c @@ -2204,16 +2204,18 @@ void ImageDrawLineV(Image *dst, Vector2 start, Vector2 end, Color color) } // Draw text (default font) within an image (destination) -void ImageDrawText(Image *dst, Vector2 position, const char *text, int fontSize, Color color) +void ImageDrawText(Image *dst, const char *text, int posX, int posY, int fontSize, Color color) { + Vector2 position = { (float)posX, (float)posY }; + // NOTE: For default font, sapcing is set to desired font size / default font size (10) - ImageDrawTextEx(dst, position, GetFontDefault(), text, (float)fontSize, (float)fontSize/10, color); + ImageDrawTextEx(dst, GetFontDefault(), text, position, (float)fontSize, (float)fontSize/10, color); } // Draw text (custom sprite font) within an image (destination) -void ImageDrawTextEx(Image *dst, Vector2 position, Font font, const char *text, float fontSize, float spacing, Color color) +void ImageDrawTextEx(Image *dst, Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint) { - Image imText = ImageTextEx(font, text, fontSize, spacing, color); + Image imText = ImageTextEx(font, text, fontSize, spacing, tint); Rectangle srcRec = { 0.0f, 0.0f, (float)imText.width, (float)imText.height }; Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height };