c-pong/src/main.c
2023-10-06 17:30:56 +02:00

40 lines
868 B
C

#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <game.h>
int main(int argc, char** argv)
{
int window_width = 500;
int window_height = 500;
const char* help =
" -w <width> Set the width of the window, default 500\n"
" -h <height> Set the height of the window, default 500\n";
int opt;
while ((opt = getopt(argc, argv, "w:h:")) != -1)
{
switch (opt)
{
case 'w':
/* Set the window width */
window_width = atoi(optarg);
break;
case 'h':
/* Set the window height */
window_height = atoi(optarg);
break;
default:
fprintf(stderr, "Unknown argument '%s'\n%s", argv[optind], help);
exit(1);
}
}
game_start(window_width, window_height);
return 0;
}