From 65f19eeec9b9e5b2b39a4d66651d04bc103e9139 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Tue, 9 Feb 2010 21:53:43 +0000 Subject: [PATCH] Text tool with bitmap fonts now uses the background color instead of color 0. It was not possible to draw text with a black font if black was color 0. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1333 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- text.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/text.c b/text.c index f465249c..eb4598f1 100644 --- a/text.c +++ b/text.c @@ -456,6 +456,7 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh SDL_Surface * Texte8Bit; SDL_Surface *Surface_fonte; byte * new_brush; + SDL_Rect rectangle; // Chargement de la fonte Surface_fonte=IMG_Load(Font_name(font_number)); @@ -476,6 +477,17 @@ byte *Render_text_SFont(const char *str, int font_number, int *width, int *heigh *width=SFont_TextWidth(font, str); // Allocation d'une surface SDL TexteColore=SDL_CreateRGBSurface(SDL_SWSURFACE, *width, *height, 24, 0, 0, 0, 0); + // Fill with backcolor + rectangle.x=0; + rectangle.y=0; + rectangle.w=*width; + rectangle.h=*height; + SDL_FillRect(TexteColore, &rectangle, SDL_MapRGB( + TexteColore->format, + Main_palette[Back_color].R, + Main_palette[Back_color].G, + Main_palette[Back_color].B + )); // Rendu du texte SFont_Write(TexteColore, font, 0, 0, str); if (!TexteColore)