mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-06 03:20:26 +00:00
viewdemo: add a legend. baller as fuck
This commit is contained in:
parent
b257f40a35
commit
7ab6febbf9
@ -34,6 +34,31 @@ view_video_demo(struct notcurses* nc){
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct ncplane*
|
||||
legend(struct notcurses* nc, int dimy, int dimx){
|
||||
struct ncplane* n = notcurses_newplane(nc, 3, dimx / 5 + 10, dimy / 8, dimx / 10, NULL);
|
||||
ncplane_set_bg_alpha(n, CELL_ALPHA_TRANS);
|
||||
uint64_t channels = 0;
|
||||
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANS);
|
||||
cell c = CELL_INITIALIZER(' ', 0, channels);
|
||||
ncplane_set_default(n, &c);
|
||||
ncplane_set_fg_rgb(n, 0, 0, 0);
|
||||
if(ncplane_putstr_aligned(n, 0, "target launch", NCALIGN_LEFT) <= 0){
|
||||
ncplane_destroy(n);
|
||||
return NULL;
|
||||
}
|
||||
ncplane_set_fg_rgb(n, 0xff, 0xff, 0xff);
|
||||
if(ncplane_putstr_aligned(n, 1, "2003-12-11 FM-6", NCALIGN_RIGHT) <= 0){
|
||||
ncplane_destroy(n);
|
||||
return NULL;
|
||||
}
|
||||
if(ncplane_putstr_aligned(n, 2, "RIM-161 SM-3 v. Aries TTV", NCALIGN_RIGHT) <= 0){
|
||||
ncplane_destroy(n);
|
||||
return NULL;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int view_demo(struct notcurses* nc){
|
||||
struct ncplane* ncp = notcurses_stdplane(nc);
|
||||
int dimy, dimx;
|
||||
@ -82,8 +107,13 @@ int view_demo(struct notcurses* nc){
|
||||
return -1;
|
||||
}
|
||||
nanosleep(&demodelay, NULL);
|
||||
struct ncplane* ncpl = legend(nc, dimy, dimx);
|
||||
if(ncpl == NULL){
|
||||
return -1;
|
||||
}
|
||||
if(view_video_demo(nc)){
|
||||
return -1;
|
||||
}
|
||||
ncplane_destroy(ncpl);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user