Browse Source

WARNING: API BREAK: Reviewed ImageDrawText*() params order

To unify with DrawText*() equivalent functions
raysan5 5 years ago
parent
commit
b132da0ac2
2 changed files with 8 additions and 6 deletions
  1. 2 2
      src/raylib.h
  2. 6 4
      src/textures.c

+ 2 - 2
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 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 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 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
 // Texture loading functions
 // NOTE: These functions require GPU access
 // NOTE: These functions require GPU access

+ 6 - 4
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)
 // 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)
     // 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)
 // 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 srcRec = { 0.0f, 0.0f, (float)imText.width, (float)imText.height };
     Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height };
     Rectangle dstRec = { position.x, position.y, (float)imText.width, (float)imText.height };