Browse Source

+ bloup

master
tth 6 months ago
parent
commit
92b7eb478c
1 changed files with 12 additions and 6 deletions
  1. +12
    -6
      tools/mkfimg.c

+ 12
- 6
tools/mkfimg.c View File

@ -21,7 +21,7 @@ int verbosity;
#define T_VDEG_A 5
#define T_TPAT0 6
#define T_MIRCOL1 7
#define T_BLOUP 8
typedef struct {
int code;
char *name;
@ -36,10 +36,11 @@ Type types[] = {
{ T_VDEG_A, "vdeg" },
{ T_TPAT0, "tpat0" },
{ T_MIRCOL1, "mircol1" },
{ T_BLOUP, "bloup" },
{ 0, NULL }
};
static int get_type(char *name)
static int get_type_by_name(char *name)
{
Type *type;
@ -65,10 +66,13 @@ int foo, cc;
puts("Usage:\tmkfimg [options] quux.fimg width height");
puts("\t-k N.N\tgive a float parameter");
fputs("\t-t bla\thowto make the pic :\n\t\t", stdout);
for (foo=0; types[foo].code; foo++) {
printf("%s ", types[foo].name);
fputs("\t-t bla\thowto make the pic :\n\t\t| ", stdout);
for (foo=cc=0; types[foo].code; foo++) {
cc += printf("%s ", types[foo].name);
if (cc>42) { cc=0; printf("\n\t\t| "); }
}
puts("\n\t-v\tincrease verbosity");
if (verbosity) {
@ -94,7 +98,8 @@ while ((opt = getopt(argc, argv, "hk:t:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'k': fvalue = atof(optarg); break;
case 't': type = get_type(tname=optarg); break;
case 't': type = get_type_by_name(tname=optarg);
break;
case 'v': verbosity++; break;
}
}
@ -154,6 +159,7 @@ switch(type) {
case T_VDEG_A: fimg_vdeg_a(&fimg, 1.0); break;
case T_TPAT0: fimg_test_pattern(&fimg, 0, fvalue); break;
case T_MIRCOL1: fimg_mircol_1(&fimg, fvalue); break;
case T_BLOUP: fimg_draw_something(&fimg); break;
case -1: exit(1);
}


Loading…
Cancel
Save