mirror of
https://github.com/dankamongmen/notcurses
synced 2025-04-02 04:40:04 -04:00
ncmenu: searching for cause of discoloration #329
This commit is contained in:
parent
2cb0a97f53
commit
25e2f59f4b
@ -6,10 +6,18 @@
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
run_menu(struct notcurses* nc, struct ncmenu* ncm){
|
run_menu(struct notcurses* nc, struct ncmenu* ncm){
|
||||||
struct ncplane* selplane = ncplane_aligned(notcurses_stdplane(nc), 1, 40, 10, NCALIGN_CENTER, NULL);
|
struct ncplane* selplane = ncplane_aligned(notcurses_stdplane(nc), 3, 40, 10, NCALIGN_CENTER, NULL);
|
||||||
if(selplane == NULL){
|
if(selplane == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
ncplane_set_fg(selplane, 0x0);
|
||||||
|
ncplane_set_bg(selplane, 0xdddddd);
|
||||||
|
uint64_t channels = 0;
|
||||||
|
channels_set_fg(&channels, 0x000088);
|
||||||
|
channels_set_bg(&channels, 0x88aa00);
|
||||||
|
if(ncplane_set_base(selplane, channels, 0, " ") < 0){
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
char32_t keypress;
|
char32_t keypress;
|
||||||
ncinput ni;
|
ncinput ni;
|
||||||
notcurses_render(nc);
|
notcurses_render(nc);
|
||||||
@ -54,7 +62,7 @@ run_menu(struct notcurses* nc, struct ncmenu* ncm){
|
|||||||
}
|
}
|
||||||
ncplane_erase(selplane);
|
ncplane_erase(selplane);
|
||||||
const char* selitem = ncmenu_selected(ncm);
|
const char* selitem = ncmenu_selected(ncm);
|
||||||
ncplane_putstr_yx(selplane, 0, 0, selitem ? selitem : "");
|
ncplane_putstr_aligned(selplane, 1, NCALIGN_CENTER, selitem ? selitem : "");
|
||||||
notcurses_render(nc);
|
notcurses_render(nc);
|
||||||
}
|
}
|
||||||
ncmenu_destroy(nc, ncm);
|
ncmenu_destroy(nc, ncm);
|
||||||
@ -103,10 +111,17 @@ int main(void){
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
notcurses_render(nc);
|
|
||||||
int dimy, dimx;
|
|
||||||
struct ncplane* n = notcurses_stdplane(nc);
|
struct ncplane* n = notcurses_stdplane(nc);
|
||||||
|
int dimy, dimx;
|
||||||
ncplane_dim_yx(n, &dimy, &dimx);
|
ncplane_dim_yx(n, &dimy, &dimx);
|
||||||
|
uint64_t channels = 0;
|
||||||
|
channels_set_fg(&channels, 0x88aa00);
|
||||||
|
channels_set_bg(&channels, 0x000088);
|
||||||
|
if(ncplane_set_base(n, channels, 0, "x") < 0){
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
notcurses_render(nc);
|
||||||
ncplane_set_fg(n, 0x00dddd);
|
ncplane_set_fg(n, 0x00dddd);
|
||||||
if(ncplane_putstr_aligned(n, dimy - 1, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=- ") < 0){
|
if(ncplane_putstr_aligned(n, dimy - 1, NCALIGN_RIGHT, " -=+ menu poc. press q to exit +=- ") < 0){
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user