I got passed the TTF_INIT() and it returned 0 which means that it was initialized ok.
I even checked TTF_WasInit() and that was also ok saying it was already loaded.
But when I tried opening a font with this code:
TTF_Font* fFont = 0;
fFont = TTF_OpenFont("./sample.ttf", 12); //open a fontfile and set fontsize
if(fFont == NULL) //check if fFont is NULL, if so output error message
{
std::cout << "Font: " << fFont << std::endl;
std::cout << "TTF_OpenFont: " << TTF_GetError() << std::endl;
}
it returned NULL and variable fFont displayed 00000000and TTF_GetError() was empty (opaque,blank,displayed nothing)
also got NO compile errors and the executable ran correctly, but wouldn't load the font.
The solution for me was:
* Dowloaded the SDL_TTF sources again to have fresh and latest files, newest version that goes with latest SDL2.
* Made a new SDL include and lib folder, copied the correct files to those folders,
just to be sure that it was setup right.
* Added those folders to VC++ include and library directories selection in VS2010C++ project properties.
* Redid the compiler "additional c/c++ linker" again in VS2010C++ project properties now adding all the SDL stuff at the end of the list, making sure the kernel32.lib and all regular systemlibs was at the top of the list.
Then cleaned build, compiled and rebuild, ran the executable and then it worked loading a font and displayed text!
Think the "moral of the story" is: check that your linker is correctly setup AND that you're using the LATEST SDL2 versions of the files for both SDL2 main files and the extension library files....
Now I can finally have TEXT in the game... :) (Spent toooo many hours on this "little" #$*&! problem)
I stumbled upon this link that lead me to solving it:
http://www.gamedev.net/topic/649984-sdl2-ttf-issues-entry-point-not-found-visual-studio/
No comments:
Post a Comment
Please, no foul language, trolling, keep it clean. Thanx.