poc/menu: kill brown-bagger, add backgrounds #383

This commit is contained in:
nick black 2020-02-23 12:58:12 -05:00 committed by Nick Black
parent c9a0964034
commit 773b85e81e
2 changed files with 32 additions and 5 deletions

View File

@ -13,7 +13,7 @@
* Repack DFSG-safe tarball, upload to github * Repack DFSG-safe tarball, upload to github
* download github-spun tarball * download github-spun tarball
* remove nonfree multimedia: * remove nonfree multimedia:
* rm data/chun* data/[deflmPw]* src/demo/jungle.c * rm data/chun* data/[adeflmPw]* src/demo/jungle.c
* `tar -cJf ../v$VERSION.dfsg.tar.xz -C.. notcurses-$VERSION` * `tar -cJf ../v$VERSION.dfsg.tar.xz -C.. notcurses-$VERSION`
* upload to github * upload to github
* Build new Debian package * Build new Debian package

View File

@ -58,6 +58,7 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
notcurses_render(nc); notcurses_render(nc);
} }
ncmenu_destroy(ncm); ncmenu_destroy(ncm);
return 0;
err: err:
ncplane_destroy(selplane); ncplane_destroy(selplane);
@ -109,10 +110,22 @@ int main(void){
if(top == NULL){ if(top == NULL){
goto err; goto err;
} }
struct ncplane* n = notcurses_stdplane(nc);
int dimy, dimx; 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; uint64_t channels = 0;
channels_set_fg(&channels, 0x88aa00); channels_set_fg(&channels, 0x88aa00);
channels_set_bg(&channels, 0x000088); channels_set_bg(&channels, 0x000088);
@ -128,6 +141,19 @@ int main(void){
run_menu(nc, top); run_menu(nc, top);
ncplane_erase(n); 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; mopts.bottom = true;
struct ncmenu* bottom = ncmenu_create(nc, &mopts); struct ncmenu* bottom = ncmenu_create(nc, &mopts);
if(bottom == NULL){ 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){ if(ncplane_putstr_aligned(n, 0, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=- ") < 0){
return EXIT_FAILURE; return EXIT_FAILURE;
} }
run_menu(nc, top); run_menu(nc, bottom);
ncvisual_destroy(ncv);
if(notcurses_stop(nc)){ if(notcurses_stop(nc)){
return EXIT_FAILURE; return EXIT_FAILURE;
} }