keller demo: also cycle warmech

This commit is contained in:
nick black 2020-10-28 06:10:48 -04:00 committed by Nick Black
parent 4effee947a
commit 77733b35d2

View File

@ -4,7 +4,7 @@
static int static int
visualize(struct notcurses* nc, struct ncvisual* ncv){ visualize(struct notcurses* nc, struct ncvisual* ncv){
for(ncblitter_e b = NCBLIT_DEFAULT + 1 ; b < NCBLIT_SIXEL ; ++b){ for(ncblitter_e b = NCBLIT_DEFAULT + 1 ; b < NCBLIT_SIXEL ; ++b){
struct timespec ts = { .tv_sec = 1, .tv_nsec = 0, }; struct timespec ts = { .tv_sec = 0, .tv_nsec = GIG / 2, };
struct ncvisual_options vopts = { struct ncvisual_options vopts = {
.scaling = NCSCALE_STRETCH, .scaling = NCSCALE_STRETCH,
.blitter = b, .blitter = b,
@ -36,16 +36,22 @@ int keller_demo(struct notcurses* nc){
if(!notcurses_canopen_images(nc)){ if(!notcurses_canopen_images(nc)){
return 0; return 0;
} }
char* file = find_data("covid19.jpg"); const char* files[] = { "covid19.jpg", "warmech.bmp", NULL, };
if(file == NULL){ for(const char** file = files ; *file ; ++file){
return -1; char* f = find_data(*file);
if(f == NULL){
return -1;
}
struct ncvisual* ncv = ncvisual_from_file(f);
free(f);
if(ncv == NULL){
return -1;
}
int r = visualize(nc, ncv);
ncvisual_destroy(ncv);
if(r){
return r;
}
} }
struct ncvisual* ncv = ncvisual_from_file(file); return 0;
free(file);
if(ncv == NULL){
return -1;
}
int r = visualize(nc, ncv);
ncvisual_destroy(ncv);
return r;
} }