mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
intro: always fit orca to available size #2015
This commit is contained in:
parent
cdb884a787
commit
c3531b22bf
@ -80,14 +80,16 @@ orcashow(struct notcurses* nc, int dimy, int dimx){
|
|||||||
};
|
};
|
||||||
int odimy, odimx, scaley, scalex;
|
int odimy, odimx, scaley, scalex;
|
||||||
ncvisual_blitter_geom(nc, ncv, &vopts, &odimy, &odimx, &scaley, &scalex, NULL);
|
ncvisual_blitter_geom(nc, ncv, &vopts, &odimy, &odimx, &scaley, &scalex, NULL);
|
||||||
int rows = (odimy / scaley) + !!(odimy % scaley);
|
vopts.leny = (odimy / scaley) + !!(odimy % scaley);
|
||||||
int cols = (odimx / scalex) + !!(odimx % scalex);
|
vopts.lenx = (odimx / scalex) + !!(odimx % scalex);
|
||||||
if(cols > dimx || rows > dimy - 1){
|
if(vopts.lenx > dimx - 1){
|
||||||
ncvisual_destroy(ncv);
|
vopts.lenx = dimx - 1;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
vopts.y = dimy - rows - 1;
|
if(vopts.leny > dimy - 1){
|
||||||
vopts.x = dimx - cols;
|
vopts.leny = dimy - 1;
|
||||||
|
}
|
||||||
|
vopts.y = dimy - vopts.leny - 1;
|
||||||
|
vopts.x = dimx - vopts.lenx - 1;
|
||||||
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
||||||
ncvisual_destroy(ncv);
|
ncvisual_destroy(ncv);
|
||||||
return n;
|
return n;
|
||||||
|
Loading…
Reference in New Issue
Block a user