mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
fission demo: go both up and down #1896
This commit is contained in:
parent
20603e5012
commit
4a23acab2d
@ -27,7 +27,7 @@ The demonstrations include (see NOTES below):
|
||||
* (***c***)hunli—the strongest woman in the world
|
||||
* (***d***)ragon—the Harter-Heighway dragon curve
|
||||
* (***e***)agle—they took some time off my life, back in the day
|
||||
* (***f***)allin'—the screen falls apart under heavy blows
|
||||
* (***f***)ission—the screen falls apart under heavy blows
|
||||
* (***g***)rid—a gradient of color lain atop a great grid
|
||||
* (***h***)ighcon—high contrast text atop various colors
|
||||
* (***i***)ntro—a setting of tone
|
||||
|
@ -79,7 +79,7 @@ static struct {
|
||||
{ "chunli", chunli_demo, true, },
|
||||
{ "dragon", dragon_demo, false, },
|
||||
{ "eagle", eagle_demo, true, },
|
||||
{ "fallin'", fallin_demo, false, },
|
||||
{ "fission", fission_demo, false, },
|
||||
{ "grid", grid_demo, false, },
|
||||
{ "highcon", highcontrast_demo, false, },
|
||||
{ "intro", intro, false, },
|
||||
|
@ -34,7 +34,7 @@ int chunli_demo(struct notcurses* nc);
|
||||
int dragon_demo(struct notcurses* nc);
|
||||
int qrcode_demo(struct notcurses* nc);
|
||||
int grid_demo(struct notcurses* nc);
|
||||
int fallin_demo(struct notcurses* nc);
|
||||
int fission_demo(struct notcurses* nc);
|
||||
int highcontrast_demo(struct notcurses* nc);
|
||||
int jungle_demo(struct notcurses* nc);
|
||||
int yield_demo(struct notcurses* nc);
|
||||
|
@ -23,7 +23,9 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
|
||||
// ahead and get it kicked off
|
||||
if(rangee - ranges + 1 < FALLINGMAX){
|
||||
if(rangee < arrcount){
|
||||
speeds[rangee - ranges] = 1;
|
||||
int y;
|
||||
ncplane_yx(arr[ranges], &y, NULL);
|
||||
speeds[rangee - ranges] = y < stdy / 2 ? 1 : -1;
|
||||
++rangee;
|
||||
}
|
||||
}
|
||||
@ -38,7 +40,7 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
|
||||
int x, y;
|
||||
ncplane_yx(ncp, &y, &x);
|
||||
if(felloff){
|
||||
if(y + speeds[i] >= stdy){
|
||||
if(y + speeds[i] >= stdy || y + speeds[i] + ncplane_dim_y(ncp) < 0){
|
||||
ncplane_destroy(ncp);
|
||||
arr[ranges + i] = NULL;
|
||||
if(ranges + i + 1 == rangee){
|
||||
@ -58,7 +60,11 @@ drop_bricks(struct notcurses* nc, struct ncplane** arr, int arrcount){
|
||||
}
|
||||
if(!felloff){
|
||||
ncplane_move_yx(ncp, y + speeds[i], x);
|
||||
++speeds[i];
|
||||
if(speeds[i] < 0){
|
||||
--speeds[i];
|
||||
}else{
|
||||
++speeds[i];
|
||||
}
|
||||
}else if(i){
|
||||
if(rangee - ranges - i){
|
||||
memmove(speeds, speeds + i, (rangee - ranges - i) * sizeof(*speeds));
|
||||
@ -91,8 +97,8 @@ shuffle_in(struct ncplane** arr, int count, struct ncplane* n){
|
||||
return arr;
|
||||
}
|
||||
|
||||
// ya playin' yourself
|
||||
int fallin_demo(struct notcurses* nc){
|
||||
// you played yourself https://genius.com/De-la-soul-fallin-lyrics
|
||||
int fission_demo(struct notcurses* nc){
|
||||
int dimx, dimy;
|
||||
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
|
||||
size_t usesize = sizeof(bool) * dimy * dimx;
|
Loading…
x
Reference in New Issue
Block a user