mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
[intro] manually resize greatscott to always hit cell boundary
This commit is contained in:
parent
16c47430d6
commit
71c7432e46
@ -29,7 +29,7 @@ animate(struct notcurses* nc, struct ncplane* ncp, void* curry){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ncplane*
|
static struct ncplane*
|
||||||
greatscott(struct notcurses* nc){
|
greatscott(struct notcurses* nc, int dimx){
|
||||||
char* path = find_data("greatscott.jpg");
|
char* path = find_data("greatscott.jpg");
|
||||||
if(path == NULL){
|
if(path == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -39,11 +39,17 @@ greatscott(struct notcurses* nc){
|
|||||||
if(ncv == NULL){
|
if(ncv == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
int celldimy, celldimx;
|
||||||
|
ncplane_pixelgeom(notcurses_stdplane(nc), NULL, NULL, &celldimy, &celldimx, NULL, NULL);
|
||||||
|
if(ncvisual_resize(ncv, 18 * celldimy, celldimx * (dimx - 2))){
|
||||||
|
ncvisual_destroy(ncv);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
struct ncvisual_options vopts = {
|
struct ncvisual_options vopts = {
|
||||||
.y = 2,
|
.y = 2,
|
||||||
.x = NCALIGN_CENTER,
|
.x = NCALIGN_CENTER,
|
||||||
.blitter = NCBLIT_PIXEL,
|
.blitter = NCBLIT_PIXEL,
|
||||||
.scaling = NCSCALE_SCALE,
|
.scaling = NCSCALE_NONE,
|
||||||
.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_HORALIGNED,
|
.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_HORALIGNED,
|
||||||
};
|
};
|
||||||
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
||||||
@ -242,7 +248,7 @@ int intro(struct notcurses* nc){
|
|||||||
ncplane_destroy(on);
|
ncplane_destroy(on);
|
||||||
struct ncplane* gscott = NULL;
|
struct ncplane* gscott = NULL;
|
||||||
if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){
|
if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){
|
||||||
if((gscott = greatscott(nc)) == NULL){
|
if((gscott = greatscott(nc, cols)) == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DEMO_RENDER(nc);
|
DEMO_RENDER(nc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user