pb2ya
2006.08.07, 01:05 PM
I've been trying to get this to work for a couple hours now, I'm following a number of SDL tutorials at the moment and can't seem to get past the simple hurdle of displaying a block of text. The weird thing is, I get no compiler warnings or errors when trying to compile the following code, but the screen ends up blank with no text displayed. I've tried adding a colored background to see if I'm just printing black text on a black screen, and I've also tried this with a couple different fonts.
So, I start a new SDL application in XCode (this is written in C), include SDL_ttf.h, link the SDL_ttf framework to the compiler, and proceed to add the following code:
SDL_Surface *message = NULL;
TTF_Font *font;
SDL_Color color = { 255, 255, 255 };
font = TTF_OpenFont( "lazy.ttf", 28 );
message = TTF_RenderText_Solid( font, "blah blah blah", color );
SDL_BlitSurface( message, NULL, screen, NULL );
SDL_Flip(screen);
Normally, this compiles and runs without trouble, but when I test each one of the statements individually, the line that renders the text is the one that ends up returning. What am I doing wrong? I'm completely stumped as of what's not working here, so tell me if I'm just shooting vague questions.
So, I start a new SDL application in XCode (this is written in C), include SDL_ttf.h, link the SDL_ttf framework to the compiler, and proceed to add the following code:
SDL_Surface *message = NULL;
TTF_Font *font;
SDL_Color color = { 255, 255, 255 };
font = TTF_OpenFont( "lazy.ttf", 28 );
message = TTF_RenderText_Solid( font, "blah blah blah", color );
SDL_BlitSurface( message, NULL, screen, NULL );
SDL_Flip(screen);
Normally, this compiles and runs without trouble, but when I test each one of the statements individually, the line that renders the text is the one that ends up returning. What am I doing wrong? I'm completely stumped as of what's not working here, so tell me if I'm just shooting vague questions.