0

I've got this short piece of code

int main(int argc, char **argv) {
    al_init();
    const ALLEGRO_FONT *arial = al_load_ttf_font("arial.ttf", 12, 0);
    if ( !( 
        al_init_font_addon() &&
        al_init_ttf_addon() &&
        al_init_primitives_addon()
        )) {
        std::cout << "fail of init";
    }
    if (!arial) {
        std::cout << "fail of arial";
        return 0;
    }
}

and unfortunately it outputs "fail of arial" (inits work fine) ! I did put everything in same folder so I don't get it why it fails... Any guesses?

1 Answers1

-1

Please read this article, as it will answer your questions.

In short:

  1. You are loading the font before you are initializing the add-on.
  2. The path may be incorrect if the app is not starting up with the current working directory that you expect. See the article for how to properly set the path.
Matthew
  • 47,584
  • 11
  • 86
  • 98