|
|
|
@ -58,6 +58,7 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
|
|
|
|
|
notcurses_render(nc);
|
|
|
|
|
}
|
|
|
|
|
ncmenu_destroy(ncm);
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
err:
|
|
|
|
|
ncplane_destroy(selplane);
|
|
|
|
@ -109,10 +110,22 @@ int main(void){
|
|
|
|
|
if(top == NULL){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ncplane* n = notcurses_stdplane(nc);
|
|
|
|
|
int dimy, dimx;
|
|
|
|
|
ncplane_dim_yx(n, &dimy, &dimx);
|
|
|
|
|
struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx);
|
|
|
|
|
|
|
|
|
|
int averr;
|
|
|
|
|
|
|
|
|
|
struct ncvisual* ncv = ncplane_visual_open(n, "../data/ebolavirus_wide-0723bc3f01c644976b4df7e146a1d795aaf9d55e.jpg", &averr);
|
|
|
|
|
if(!ncv){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
if(!ncvisual_decode(ncv, &averr)){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
if(ncvisual_render(ncv, 0, 0, 0, 0)){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uint64_t channels = 0;
|
|
|
|
|
channels_set_fg(&channels, 0x88aa00);
|
|
|
|
|
channels_set_bg(&channels, 0x000088);
|
|
|
|
@ -128,6 +141,19 @@ int main(void){
|
|
|
|
|
run_menu(nc, top);
|
|
|
|
|
|
|
|
|
|
ncplane_erase(n);
|
|
|
|
|
ncvisual_destroy(ncv);
|
|
|
|
|
|
|
|
|
|
ncv = ncplane_visual_open(n, "../data/aidsrobots.jpeg", &averr);
|
|
|
|
|
if(!ncv){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
if(!ncvisual_decode(ncv, &averr)){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
if(ncvisual_render(ncv, 0, 0, 0, 0)){
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mopts.bottom = true;
|
|
|
|
|
struct ncmenu* bottom = ncmenu_create(nc, &mopts);
|
|
|
|
|
if(bottom == NULL){
|
|
|
|
@ -136,8 +162,9 @@ int main(void){
|
|
|
|
|
if(ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=- ") < 0){
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
run_menu(nc, top);
|
|
|
|
|
run_menu(nc, bottom);
|
|
|
|
|
|
|
|
|
|
ncvisual_destroy(ncv);
|
|
|
|
|
if(notcurses_stop(nc)){
|
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
}
|
|
|
|
|