Skip to content

Commit

Permalink
Fix a dependance of rtexture to rtext (#4171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Julianiolo committed Jul 20, 2024
1 parent 996f503 commit aa70d32
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rtextures.c
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,7 @@ Image GenImageText(int width, int height, const char *text)
{
Image image = { 0 };

#ifdef SUPPORT_MODULE_RTEXT
int textLength = TextLength(text);
int imageViewSize = width*height;

Expand All @@ -1223,6 +1224,10 @@ Image GenImageText(int width, int height, const char *text)
image.mipmaps = 1;

memcpy(image.data, text, (textLength > imageViewSize)? imageViewSize : textLength);
#else
TRACELOG(LOG_WARNING, "IMAGE: GenImageText() requires module: rtext");
image = GenImageColor(width, height, BLACK); // Generating placeholder black image rectangle
#endif

return image;
}
Expand Down

0 comments on commit aa70d32

Please sign in to comment.