mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
[intro] orcaride along the bottom
This commit is contained in:
parent
0484c35b79
commit
6ac95e1ab1
Binary file not shown.
Before Width: | Height: | Size: 115 KiB After Width: | Height: | Size: 111 KiB |
Binary file not shown.
@ -29,7 +29,7 @@ fader(struct notcurses* nc, struct ncplane* ncp, void* curry){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct ncplane*
|
static struct ncplane*
|
||||||
orcashow(struct notcurses* nc){
|
orcashow(struct notcurses* nc, int dimy, int dimx){
|
||||||
char* path = find_data("natasha-blur.png");
|
char* path = find_data("natasha-blur.png");
|
||||||
if(path == NULL){
|
if(path == NULL){
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -45,24 +45,28 @@ orcashow(struct notcurses* nc){
|
|||||||
};
|
};
|
||||||
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
struct ncplane* n = ncvisual_render(nc, ncv, &vopts);
|
||||||
ncvisual_destroy(ncv);
|
ncvisual_destroy(ncv);
|
||||||
|
int odimy, odimx, oy, ox;
|
||||||
|
ncplane_yx(n, &oy, &ox);
|
||||||
|
ncplane_dim_yx(n, &odimy, &odimx);
|
||||||
|
if(odimy > dimy - 2){
|
||||||
|
ncplane_destroy(n);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if(odimx > dimx){
|
||||||
|
ncplane_destroy(n);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ncplane_move_yx(n, dimy - odimy - 2, dimx - odimx);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
orcaride(struct notcurses* nc, struct ncplane* on, int dimy, int dimx, int iteration){
|
orcaride(struct notcurses* nc, struct ncplane* on, int dimy, int iteration){
|
||||||
if(iteration % 2){
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int odimy, odimx, oy, ox;
|
int odimy, odimx, oy, ox;
|
||||||
ncplane_yx(on, &oy, &ox);
|
ncplane_yx(on, &oy, &ox);
|
||||||
ncplane_dim_yx(on, &odimy, &odimx);
|
ncplane_dim_yx(on, &odimy, &odimx);
|
||||||
if(iteration % 4 == 0){
|
if(ox >= odimx / 2){
|
||||||
if(oy + odimy + 5 < dimy){
|
ox -= odimx / 2;
|
||||||
oy += 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(ox + odimx + 5 < dimx){
|
|
||||||
ox += 5;
|
|
||||||
}
|
}
|
||||||
if(ncplane_move_yx(on, oy, ox)){
|
if(ncplane_move_yx(on, oy, ox)){
|
||||||
return -1;
|
return -1;
|
||||||
@ -191,7 +195,7 @@ int intro(struct notcurses* nc){
|
|||||||
}
|
}
|
||||||
struct ncplane* on = NULL;
|
struct ncplane* on = NULL;
|
||||||
if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){
|
if(notcurses_check_pixel_support(nc) && notcurses_canopen_images(nc)){
|
||||||
on = orcashow(nc);
|
on = orcashow(nc, rows, cols);
|
||||||
}
|
}
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
@ -207,7 +211,9 @@ int intro(struct notcurses* nc){
|
|||||||
demo_nanosleep(nc, &iter);
|
demo_nanosleep(nc, &iter);
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
if(on){
|
if(on){
|
||||||
orcaride(nc, on, rows, cols, flipmode);
|
if(flipmode % 5 == 0){
|
||||||
|
orcaride(nc, on, rows, flipmode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}while(timespec_to_ns(&now) < deadline);
|
}while(timespec_to_ns(&now) < deadline);
|
||||||
ncplane_destroy(on);
|
ncplane_destroy(on);
|
||||||
|
@ -415,7 +415,7 @@ write_rle(int* printed, int color, FILE* fp, int seenrle, unsigned char crle){
|
|||||||
|
|
||||||
// Emit the sprixel in its entirety, plus enable and disable pixel mode.
|
// Emit the sprixel in its entirety, plus enable and disable pixel mode.
|
||||||
static int
|
static int
|
||||||
write_sixel_data(FILE* fp, int lenx, sixeltable* stab, int* parse_start, int* tacache){
|
write_sixel_data(FILE* fp, int lenx, int leny, sixeltable* stab, int* parse_start, int* tacache){
|
||||||
*parse_start = fprintf(fp, "\ePq");
|
*parse_start = fprintf(fp, "\ePq");
|
||||||
// Set Raster Attributes - pan/pad=1 (pixel aspect ratio), Ph=lenx, Pv=leny
|
// Set Raster Attributes - pan/pad=1 (pixel aspect ratio), Ph=lenx, Pv=leny
|
||||||
// using Ph/Pv causes a background to be drawn using color register 0 for all
|
// using Ph/Pv causes a background to be drawn using color register 0 for all
|
||||||
@ -502,7 +502,7 @@ int sixel_blit_inner(ncplane* nc, int leny, int lenx, sixeltable* stab,
|
|||||||
free(buf);
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(write_sixel_data(fp, lenx, stab, &parse_start, tacache)){
|
if(write_sixel_data(fp, lenx, leny, stab, &parse_start, tacache)){
|
||||||
free(tacache);
|
free(tacache);
|
||||||
free(buf);
|
free(buf);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user