problem with SDL_ttf

Started by
13 comments, last by rip-off 12 years, 8 months ago
The font you pass to the function, has it been created with TTF_OpenFont?
Advertisement

The font you pass to the function, has it been created with TTF_OpenFont?


Nope. I did this...

TTF_Font *font;


I learned it from lazy foo'

E:nvm i think you were talking about this

font = TTF_OpenFont( "Media/A Love of Thunder.tff", 28 );
Okay it works now, i wrote .tff instead of .ttf XD
[color=#1C2837][size=2]Okay i got it working but i dont understand what you mean about a variable to hold the directory? [/quote]
std::string filename = "gfx\\foo.bmp";

and use that in your function [color=#1C2837][font=CourierNew, monospace][size=2][color=#000000]TTF_OpenFont[color=#666600]([color=#000000]filename.c_str()[color=#666600], fontSize[color=#666600]);[/font]
[color=#1C2837][font=CourierNew, monospace][size=2][color=#666600]
[/font]
[color=#1C2837][font=CourierNew, monospace][size=2][color=#666600]But you seem to have it all well so never mind about that.[/font]
You should add more error checking to your code. Practically every SDL function can return an error. If you had checked TT_OpenFont() for errors you would have seen that it had failed to open the file before your program decided to crash.

This topic is closed to new replies.

Advertisement