I am having Problem loading SDL_TTF font.
my program is so big, so there's a piece of code which is creating problem.
TTF_Font *font = NULL;
SDL_Color textColor = {255, 255, 255};
if(SDL_Init() == -1 || TTF_Init() == -1)
return 0;
font = TTF_OpenFont("calibri.ttf", 28);
if(font == NULL)
return 0;
Now please tell me why the funtion TTF_OpenFont is not working. font remains NULL after the funtion and the program exits...
EDIT: I cannot cout or printf TTF_GetError() but i used breakpoints to see which function is not working correctly and found the function TTF_OpenFont() returning null every time. (BTW if there any way to print the Erroe on screen the tell please). TTF_Init() is working correctly. FOR PEOPLE WHO ARE ASKING TO INSTALL SDL_TTF SEPARATELY: I have written the link below from which i am learning SDL in first tutorial it guides how to install SDL and integrate it which project, In 3rd lesson comes the SDL_IMAGE extension library which is to be needed to install separately (which i did and used all image functions easily), In 7th lesson it didn't teach how to install SDL_TFF rather says to do the same steps as for SDL_IMAGE but this time for SDL_TTf so i downloaded SDL_TTF and intalled and you know the rest after....
Windows 8.1, CodeBlocks, MinGW32, SDL1 Here's the link i am learning SDL from SDL Tutorials This is how i installed the Extension Library(SDL_TTF) Setting Up Extention Library
PROBLEM SOLVED. Thanks EveryOne for giving your time... the problem was program was not recognizing font(candara ) so it copy pasted in my project folder.