I’m trying to draw text with outline font in two
colors. My codes look something like this:
SDL_Color black = { 0x00, 0x00, 0x00, 0 };
SDL_Color red = { 0xFF, 0x00, 0x00, 0 };
text0=
TTF_RenderUNICODE_Solid(font,(Uint16*)“aSfU\000”,
red);
text1=
TTF_RenderUNICODE_Solid(font,(Uint16*)“aSfU\000”,
black);
text2= SDL_ConvertSurface( text0, text0->format,
SDL_SWSURFACE);
// Draw outline with shifted text
dstrect.w = text2->w;
dstrect.h = text2->h;
dstrect.x = 0;
dstrect.y = 1;
SDL_BlitSurface( text0, NULL, text2, &dstrect);
dstrect.y = 3;
SDL_BlitSurface( text0, NULL, text2, &dstrect);
…
dstrect.x = 2;
SDL_BlitSurface( text0, NULL, text2, &dstrect);
// Draw the centre text in black
dstrect.x = 0;
dstrect.y = 2;
SDL_BlitSurface( text1, NULL, text2, &dstrect);
…
SDL_BlitSurface( text2, NULL, screen, &dstrect)
I know, It’s a bit messy with the different surfaces.
Everything looks okay. But… when I start
experimenting with the RGB values for the centre text.
All other colors don’t work. They either appear as red
or background color.
Is that because a palette is used in the format?
Is that the way I handle the 3 surfaces?
Can someone suggest a solution for that and any 2
colors can be used?
thanks
Phuoc Can HUA
/_/_/_/_/_/_
www.huaonline.com
My Homepage is my Castle
Make the switch to the world's best email. Get the new Yahoo!7 Mail now. www.yahoo7.com.au/worldsbestemail