diff options
| author | Ray <raysan5@gmail.com> | 2015-10-25 01:50:15 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2015-10-25 01:50:15 +0200 |
| commit | afdf357fbee7f01535bddefb4e62cb1308ed55b5 (patch) | |
| tree | fb0a070f8e1a85ece1dcf8619a67969798cc30b1 /src/text.c | |
| parent | 8c117cfb570874e726d6a24a4b85573e0c7b1669 (diff) | |
| download | raylib-afdf357fbee7f01535bddefb4e62cb1308ed55b5.tar.gz raylib-afdf357fbee7f01535bddefb4e62cb1308ed55b5.zip | |
Added some image manipulation functions
Added (or completed functions):
Image ImageText(const char *text, int fontSize, Color color);
Image ImageTextEx(SpriteFont font, const char *text, int fontSize, int
spacing, Color tint);
void ImageFlipVertical(Image *image);
void ImageFlipHorizontal(Image *image);
void ImageColorTint(Image *image, Color color);
void ImageColorInvert(Image *image);
void ImageColorGrayscale(Image *image);
void ImageColorContrast(Image *image, float contrast);
void ImageColorBrightness(Image *image, int brightness);
Diffstat (limited to 'src/text.c')
| -rw-r--r-- | src/text.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -279,9 +279,7 @@ void DrawText(const char *text, int posX, int posY, int fontSize, Color color) Vector2 position = { (float)posX, (float)posY }; int defaultFontSize = 10; // Default Font chars height in pixel - if (fontSize < defaultFontSize) fontSize = defaultFontSize; - int spacing = fontSize / defaultFontSize; DrawTextEx(defaultFont, text, position, fontSize, spacing, color); @@ -380,7 +378,7 @@ Vector2 MeasureTextEx(SpriteFont spriteFont, const char *text, int fontSize, int for (int i = 0; i < len; i++) { - textWidth += spriteFont.charRecs[(int)text[i] - FONT_FIRST_CHAR].width; + if (text[i] != '\n') textWidth += spriteFont.charRecs[(int)text[i] - FONT_FIRST_CHAR].width; } if (fontSize <= spriteFont.charRecs[0].height) scaleFactor = 1.0f; |
