require font file argument; print errors to stderr

This commit is contained in:
Josh Holtrop 2018-01-23 16:06:46 -05:00
parent 52beedf848
commit d9a3a6cb5a

View File

@ -79,9 +79,15 @@ static Uint32 UpdateCallback(Uint32 interval, void * param)
int main(int argc, char *argv[])
{
if (argc != 2)
{
fprintf(stderr, "Usage: %s <font-file>\n", argv[0]);
return 1;
}
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER))
{
printf("Failed to initialize SDL!\n");
fprintf(stderr, "Failed to initialize SDL!\n");
return 1;
}
@ -95,7 +101,7 @@ int main(int argc, char *argv[])
SDL_WINDOW_OPENGL);
if (!window)
{
printf("Failed to create window!\n");
fprintf(stderr, "Failed to create window!\n");
SDL_Quit();
return 2;
}
@ -104,12 +110,12 @@ int main(int argc, char *argv[])
if (gl3wInit())
{
cerr << "Failed to initialize GL3W" << endl;
fprintf(stderr, "Failed to initialize GL3W");
return 2;
}
if (!gl3wIsSupported(3, 0))
{
cerr << "OpenGL 3.0 is not supported!" << endl;
fprintf(stderr, "OpenGL 3.0 is not supported!");
return 2;
}