dragon/view demos: don't disturb menu bar

This commit is contained in:
nick black 2020-06-16 02:24:27 -04:00
parent cfe764bd57
commit d7b04217f9
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 7 additions and 3 deletions

View File

@ -49,19 +49,19 @@ int dragon_demo(struct notcurses* nc){
done = false; done = false;
int dimy, dimx; int dimy, dimx;
struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx); struct ncplane* n = notcurses_stddim_yx(nc, &dimy, &dimx);
--dimy; // don't disturb the menu bar
// we use a Lindenmayer string rewriting system. the classic dragon curve // we use a Lindenmayer string rewriting system. the classic dragon curve
// system is X -> X+YF+, Y -> -FX-Y, where F is forward, - is turn left, and // system is X -> X+YF+, Y -> -FX-Y, where F is forward, - is turn left, and
// + is turn right. // + is turn right.
const char LINDENSTART[] = "FX"; const char LINDENSTART[] = "FX";
const int SCALE = 1;
dimy *= 2; dimy *= 2;
dimx *= 2; dimx *= 2;
int dxstart, dystart; int dxstart, dystart;
if(dimy > dimx){ if(dimy > dimx){
dystart = 0; dystart = 0;
dxstart = SCALE; dxstart = 1;
}else{ }else{
dystart = SCALE; dystart = 1;
dxstart = 0; dxstart = 0;
} }
size_t fbbytes = sizeof(uint32_t) * dimy * dimx; size_t fbbytes = sizeof(uint32_t) * dimy * dimx;
@ -101,6 +101,7 @@ int dragon_demo(struct notcurses* nc){
struct ncvisual_options vopts = { struct ncvisual_options vopts = {
.n = n, .n = n,
.blitter = NCBLIT_2x2, .blitter = NCBLIT_2x2,
.y = 1,
}; };
if(ncvisual_render(nc, ncv, &vopts) == NULL){ if(ncvisual_render(nc, ncv, &vopts) == NULL){
ncvisual_destroy(ncv); ncvisual_destroy(ncv);
@ -108,6 +109,7 @@ int dragon_demo(struct notcurses* nc){
} }
DEMO_RENDER(nc); DEMO_RENDER(nc);
demo_nanosleep(nc, &scaled); demo_nanosleep(nc, &scaled);
ncplane_erase(n);
}while(lasttotal != r); }while(lasttotal != r);
ncvisual_destroy(ncv); ncvisual_destroy(ncv);
return 0; return 0;

View File

@ -16,6 +16,7 @@ view_video_demo(struct notcurses* nc){
.scaling = NCSCALE_STRETCH, .scaling = NCSCALE_STRETCH,
.n = ncp, .n = ncp,
.blitter = NCBLIT_2x2, .blitter = NCBLIT_2x2,
.y = 1,
}; };
int ret = ncvisual_stream(nc, ncv, &err, 2.0/3.0 * delaymultiplier, int ret = ncvisual_stream(nc, ncv, &err, 2.0/3.0 * delaymultiplier,
demo_simple_streamer, &vopts, NULL); demo_simple_streamer, &vopts, NULL);
@ -81,6 +82,7 @@ view_images(struct notcurses* nc, struct ncplane* nstd, int dimy, int dimx){
.n = dsplane, .n = dsplane,
.scaling = NCSCALE_STRETCH, .scaling = NCSCALE_STRETCH,
.blitter = NCBLIT_2x2, .blitter = NCBLIT_2x2,
.y = 1,
}; };
if(ncvisual_render(nc, ncv2, &vopts) == NULL){ if(ncvisual_render(nc, ncv2, &vopts) == NULL){
ncvisual_destroy(ncv2); ncvisual_destroy(ncv2);