fallen: open the curtain on patents.png

pull/287/head
nick black 5 years ago committed by Nick Black
parent ff34fb387a
commit 98fe08727b

@ -65,5 +65,10 @@ Proper display requires:
* A monospaced font, and
* Good Unicode support in your libc, font, and terminal emulator.
# BUGS
If notcurses is built without FFmpeg, the following demos will fail immedaitely when specified: **xray**,
**eagle**, **chunli**, **fallin**, **view**, **outro**.
# SEE ALSO
notcurses(3notcurses), ncurses(3ncurses), terminfo(5)

@ -11,7 +11,6 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
struct timespec iterdelay;
// 5 * demodelay total
ns_to_timespec(timespec_to_ns(&demodelay) / arrcount / 2, &iterdelay);
ncplane_erase(notcurses_stdplane(nc));
// we've got a range of up to 10 total blocks falling at any given time. they
// accelerate as they fall. [ranges, reange) covers the active range.
int ranges = 0;
@ -23,7 +22,6 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
// ahead and get it kicked off
if(rangee - ranges + 1 < FALLINGMAX){
if(rangee < arrcount){
ncplane_greyscale(arr[rangee]);
speeds[rangee - ranges] = 1;
++rangee;
}
@ -108,6 +106,7 @@ int fallin_demo(struct notcurses* nc){
// * maxy/maxx: maximum geometry of randomly-generated bricks
// * newy/newx: actual geometry of current brick
// * usey/usex:
ncplane_greyscale(notcurses_stdplane(nc));
for(int y = 0 ; y < dimy ; ++y){
int x = 0;
while(x < dimx){
@ -164,5 +163,26 @@ int fallin_demo(struct notcurses* nc){
}
}
free(usemap);
return drop_bricks(nc, arr, arrcount);
int averr = 0;
char* path = find_data("lamepatents.jpg");
struct ncvisual* ncv = ncplane_visual_open(notcurses_stdplane(nc), path, &averr);
free(path);
if(ncv == NULL){
return -1;
}
if(ncvisual_decode(ncv, &averr) == NULL){
ncvisual_destroy(ncv);
return -1;
}
if(ncvisual_render(ncv, 0, 0, 0, 0)){
ncvisual_destroy(ncv);
return -1;
}
notcurses_render(nc);
int ret = drop_bricks(nc, arr, arrcount);
assert(ncvisual_decode(ncv, &averr) == NULL);
assert(averr == AVERROR_EOF);
ncvisual_destroy(ncv);
ncplane_pulse(notcurses_stdplane(ncv), &demodelay, pulser);
return ret;
}

@ -160,21 +160,6 @@ int sliding_puzzle_demo(struct notcurses* nc){
int wastex = ((maxx - 2) - (CHUNKS_HORZ * chunkx)) / 2;
struct ncplane* n = notcurses_stdplane(nc);
ncplane_erase(n);
int averr = 0;
char* path = find_data("lamepatents.jpg");
struct ncvisual* ncv = ncplane_visual_open(n, path, &averr);
free(path);
if(ncv == NULL){
return -1;
}
if(ncvisual_decode(ncv, &averr) == NULL){
ncvisual_destroy(ncv);
return -1;
}
if(ncvisual_render(ncv, 0, 0, 0, 0)){
ncvisual_destroy(ncv);
return -1;
}
const int chunkcount = CHUNKS_VERT * CHUNKS_HORZ;
struct ncplane** chunks = malloc(sizeof(*chunks) * chunkcount);
if(chunks == NULL){
@ -240,7 +225,6 @@ int sliding_puzzle_demo(struct notcurses* nc){
ret = 0;
done:
ncvisual_destroy(ncv);
for(z = 0 ; z < chunkcount ; ++z){
ncplane_destroy(chunks[z]);
}

Loading…
Cancel
Save