I think this was answered before - I searched the forum but can’t find a
definitive answer.
I downloaded the latest packaged source-code for SDL_ttf, and did this:
./configure --with-sdl-prefix=$HOME/.SDL --prefix=$HOME/.SDL
make && make install
I have SDL 1.3 install in ~/.SDL
This builds fine with no errors. Then, when I compile my program, none of
the text displays. Everything initializes fine with no issues or errors,
but I can’t see my text. Here is my code to print:
void printxy( char *text, int x, int y, Uint8 r, Uint8 g, Uint8 b ) {
if( !font ) { printf( “No font to print!\n” ); return; } // Can’t
print without font
if( !text ) { printf( “No text to print!\n” ); return; } // Can’t
print without text
SDL_Color c;
SDL_Rect rt;
c.r = r; c.g = g; c.b = b;
SDL_Surface *surface = TTF_RenderText_Solid( font, (const char *)text, c
);
SDL_Texture *texture = SDL_CreateTextureFromSurface( 0, surface );
rt.x = x; rt.y = y; rt.w = surface->w; rt.h = surface->h;
//SDL_SetRenderDrawBlendMode( SDL_BLENDMODE_NONE );
SDL_RenderCopy( texture, NULL, NULL );
SDL_DestroyTexture( texture );
SDL_FreeSurface( surface );
}
font is a global variable that has been set properly. I don’t get segfaults
or anything! It just doesn’t print.
Any suggestions?
-Alex