int main(int argc, const char **argv) { unsigned char *buf, *c, *d; int n, x, y, w, h, imgsz, readsz; if (argc<3) { printf ("stiv . suckless terminal image viewer\n"); printf ("Usage: stiv [width] [height] [ascii|ansi|grey|256|rgb] < rgb24\n"); return 1; } w = atoi (argv[1]); h = atoi (argv[2]); if (argc>3) { selectrenderer (argv[3]); } else renderer = render_rgb; if (w<1 || h<1) { printf ("Invalid arguments\n"); return 1; } imgsz = w * h * 3; buf = malloc (imgsz); readsz = 0; do { n = read (0, buf+readsz, imgsz); if (n<1) break; readsz += n; } while (readsz < imgsz); dorender (buf, readsz, w, h); free (buf); return 0; }
int main (int argc, char** argv) { SKELETON* model=NULL; /* Stores the skeleton (from ASF file) */ MOCAP* motion=NULL; /* Stores the motion capture data (from AMC file) */ int delay=0; /* Stores the optional delay used to slow down animation on fast PCs */ /* Check we have both command line arguments */ if (argc<2 || argc>4) { printf("Use MOCAPTEST <asf file> <amc file> [optional delay]\n"); return (EXITCODE_BADSYNTAX); } /* Load the ASF file (skeleton) into 'model' */ if (!(model=parser_loadSkeleton(argv[1]))) { printf("FATAL: Failed to load skeleton from file\n"); return (EXITCODE_BADSKEL); } /* Print out the skeleton hierarchy just for info */ parser_debugskeletonTree(model); /* Load the AMC file (motion capture data) into 'mocap' */ if (!(motion=parser_loadMocap(argv[2],model))) { printf("FATAL: Failed to load mocap data from file\n"); return (EXITCODE_BADMOCAP); } if (argc==4) { delay=atoi(argv[3]); printf("Pausing %dms at each cycle\n",delay); } /* TODO - Render an animation of the moving skeleton */ dorender(argc,argv,model,motion,delay); /* Actually the dorender(..) call will never return from the GLUT loop so this line is redundant */ return (EXITCODE_SUCCESS); }