Ttf_rendertext_solid


Pickle

Mega GP Mania
Joined
May 30, 2006
Messages
5,518
Location
Detroit, Michigan
Website
Visit site
Anyone know what this really means:
fg: The color to render the text in. This becomes colormap index 1.
SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, const char *text, SDL_Color fg)
SDL_Surface *TTF_RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg)
SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font, const Uint16 *text, SDL_Color fg);
 
Pickle said:
Anyone know what this really means:
fg: The color to render the text in. This becomes colormap index 1.
SDL_Surface *TTF_RenderText_Solid(TTF_Font *font, const char *text, SDL_Color fg)
SDL_Surface *TTF_RenderUTF8_Solid(TTF_Font *font, const char *text, SDL_Color fg)
SDL_Surface *TTF_RenderUNICODE_Solid(TTF_Font *font, const Uint16 *text, SDL_Color fg);
Just a shot in the dark but the surface returned from the Render functions will have the fg colour that you specified as the 1st(?) entry in the palette (colourmap) for that particular surface. Unless you intend to play with Colormaps, you won't need to know this. Usually with text, you then just blit that surface directly to another (i.e. your game screen) and SDL sorts out the colours for you.

I questioned the "1st" bit because I don't know if the Colormap is zero-based (which is likely), so in that case it would be the 2nd entry in the Colormap. That would make me wonder what the 1st colour would be, probably just the empty background Color of the surface returned.
 
Last edited by a moderator:
The "0" colour in the palette is the transparent colour, and colour "1" is the foreground (text) colour. I vaguely remember that changing the palette colour for the text means you can change the text colour without re-rendering it, but that could just be me imagining things - I stick to bitmap fonts only nowadays :)
 
The reason for my question is strange behavior I have with the dosbox keyboard osd.
I create a surface for each character then blit that character. For the selected character's I change the color, but its not the actual color I specified. And if you change the color on the fly you get all kinds of random colors.
 
Pickle said:
It didnt work as I might have suspected. Dosbox is normally in 8 bit mode.
Ah, OK :)

Must be some palette related shenanigans then, sorry it didn't help.

I can't help with GP2X specific stuff at the minute, but if you have PC compatible source (if the problem isn't 2X specific) I could have a mess around with it if you like.
 
Last edited by a moderator:
fishybawb said:
Pickle said:
It didnt work as I might have suspected. Dosbox is normally in 8 bit mode.
Ah, OK :)

Must be some palette related shenanigans then, sorry it didn't help.

I can't help with GP2X specific stuff at the minute, but if you have PC compatible source (if the problem isn't 2X specific) I could have a mess around with it if you like.


Thanks but, I think I will give it another go this weekend and maybe switch some things around ans see if I cant solve it myself. If I cant well I will come back and post again.
 
Last edited by a moderator:
Pickle said:
fishybawb said:
Pickle said:
It didnt work as I might have suspected. Dosbox is normally in 8 bit mode.
Ah, OK :)

Must be some palette related shenanigans then, sorry it didn't help.

I can't help with GP2X specific stuff at the minute, but if you have PC compatible source (if the problem isn't 2X specific) I could have a mess around with it if you like.


Thanks but, I think I will give it another go this weekend and maybe switch some things around ans see if I cant solve it myself. If I cant well I will come back and post again.


Ok i finally found the problem, it was a surface format problem in my SDL_MapRGB that I was using in the SDL colorkey function. So now the colors are correct.
 
Last edited by a moderator:
Back
Top