mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
dragon/view demos: don't disturb menu bar
This commit is contained in:
parent
cfe764bd57
commit
d7b04217f9
@ -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;
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user