SDL_ttf problem

Hello!
I’m new on this list, and I’m beginning to learn SDL.
I have a problem with the SDL_ttf library, with the text rendering.

Here is the relevant part of the code:

TTF_Font *font = NULL;
SDL_Surface *message = NULL;
SDL_Color textColor = { 255, 255, 255 };

font = TTF_OpenFont( “/usr/share/fonts/corefonts/times.ttf”, 28 );
if( font == NULL ) { return 1; }

message = TTF_RenderText_Solid( font, “bla bla bla”, textColor );
if( message == NULL ) { return 1; }

For some reason, the “message” surface hasn’t been created, and the pointer
remains NULL.
If someone knows the reason, please help me.

Thanks,
Istvan

Hi.

maybe sdl isn’t able to create 8bit palettized surfaces!
you could try to replace the TTF_RenderText_Solid call with
TTF_RenderText_Blended(), this worked for me.

Regards

Istv?n Stef?n schrieb:> Hello!

I’m new on this list, and I’m beginning to learn SDL.
I have a problem with the SDL_ttf library, with the text rendering.

Here is the relevant part of the code:

TTF_Font *font = NULL;
SDL_Surface *message = NULL;
SDL_Color textColor = { 255, 255, 255 };

font = TTF_OpenFont( “/usr/share/fonts/corefonts/times.ttf”, 28 );
if( font == NULL ) { return 1; }

message = TTF_RenderText_Solid( font, “bla bla bla”, textColor );
if( message == NULL ) { return 1; }

For some reason, the “message” surface hasn’t been created, and the pointer
remains NULL.
If someone knows the reason, please help me.

Thanks,
Istvan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hello!
Thanks for the answer, I think aou are right.
I’ve tried TTF_RenderText_Shaded, and it works well.

Thanks for the help,
Istvan

p?ntek 27 okt?ber 2006 11.47 d?tummal Udo Philipps ezt ?rta:

Hi.

maybe sdl isn’t able to create 8bit palettized surfaces!
you could try to replace the TTF_RenderText_Solid call with
TTF_RenderText_Blended(), this worked for me.

Regards

Istv?n Stef?n schrieb:

Hello!
I’m new on this list, and I’m beginning to learn SDL.
I have a problem with the SDL_ttf library, with the text rendering.

Here is the relevant part of the code:

TTF_Font *font = NULL;
SDL_Surface *message = NULL;
SDL_Color textColor = { 255, 255, 255 };

font = TTF_OpenFont( “/usr/share/fonts/corefonts/times.ttf”, 28 );
if( font == NULL ) { return 1; }

message = TTF_RenderText_Solid( font, “bla bla bla”, textColor );
if( message == NULL ) { return 1; }

For some reason, the “message” surface hasn’t been created, and the
pointer> > remains NULL.

If someone knows the reason, please help me.

Thanks,
Istvan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hello!
Thanks for the answer, I think aou are right.
I’ve tried TTF_RenderText_Shaded, and it works well.

Thanks for the help,
Istvan

p?ntek 27 okt?ber 2006 11.47 d?tummal Udo Philipps ezt ?rta:

Hi.

maybe sdl isn’t able to create 8bit palettized surfaces!
you could try to replace the TTF_RenderText_Solid call with
TTF_RenderText_Blended(), this worked for me.

Regards

Istv?n Stef?n schrieb:

Hello!
I’m new on this list, and I’m beginning to learn SDL.
I have a problem with the SDL_ttf library, with the text rendering.

Here is the relevant part of the code:

TTF_Font *font = NULL;
SDL_Surface *message = NULL;
SDL_Color textColor = { 255, 255, 255 };

font = TTF_OpenFont( “/usr/share/fonts/corefonts/times.ttf”, 28 );
if( font == NULL ) { return 1; }

message = TTF_RenderText_Solid( font, “bla bla bla”, textColor );
if( message == NULL ) { return 1; }

For some reason, the “message” surface hasn’t been created, and the
pointer> > remains NULL.

If someone knows the reason, please help me.

Thanks,
Istvan


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl