- char filename[] = "test.bmp";
- char outname[] = "test.gfx";
- rawbmp = SDL_LoadBMP(filename);
-
+ int opt;
+ char * infile;
+ char outfile[256];
+ bool bout = false;
+
+ while ((opt = getopt(argc, argv, "po:sv:")) != -1) {
+ switch (opt) {
+ case 'p':
+ printf("include palette");
+ break;
+ case 'o':
+ printf("output file %s\n", optarg);
+ strcpy(outfile, optarg);
+ bout = true;
+ break;
+ case 's':
+ printf("generate gfx per 16x16 tile \n");
+ break;
+ case 'v':
+ break;
+ default: /* '?' */
+ fprintf(stderr, "Usage: %s [-s] [-o output] file \n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (optind >= argc) {
+ fprintf(stderr, "Expected infile\n");
+ fprintf(stderr, "Usage: %s [-s] [-o output] [file]\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ infile = argv[optind];
+
+ rawbmp = SDL_LoadBMP(infile);