take font file as a command-line argument

This commit is contained in:
Josh Holtrop 2014-06-10 13:23:19 -04:00
parent 0a115cea0d
commit d4a4cfc9df

View File

@ -25,6 +25,12 @@ void display(SDL_Window * window)
int main(int argc, char *argv[])
{
if (argc < 2)
{
cerr << "Usage: " << argv[0] << " <font>" << endl;
return 1;
}
if (SDL_Init(SDL_INIT_VIDEO))
{
cerr << "Failed to initialize SDL!" << endl;
@ -68,9 +74,9 @@ int main(int argc, char *argv[])
return 2;
}
if (FT_New_Face(ft, "/usr/share/fonts/truetype/freefont/FreeMono.ttf", 0, &face) != 0)
if (FT_New_Face(ft, argv[1], 0, &face) != 0)
{
cerr << "Could not load FreeMono.ttf" << endl;
cerr << "Could not load font " << argv[1] << endl;
return 2;
}