normal-demo: get a nice scroll-opening

pull/632/head
nick black 4 years ago
parent 1337091c46
commit d37a3934d1
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -44,7 +44,9 @@ int normal_demo(struct notcurses* nc){
if(!rgba){
goto err;
}
memset(rgba, 0, sizeof(*rgba) * dy * dx);
for(int off = 0 ; off < dy * dx ; ++off){
rgba[off] = 0xff000000;
}
int y;
if(dy / VSCALE % 2){
y = dy / VSCALE + 1;
@ -54,6 +56,8 @@ int normal_demo(struct notcurses* nc){
}
}
}
struct timespec scaled;
timespec_div(&demodelay, dy, &scaled);
for(y = 0 ; y < dy / 2 ; ++y){
for(int x = 0 ; x < dx ; ++x){
if(mcell(offset(rgba, dy / 2 - y, x, dx), dy / 2 - y, x, dy, dx)){
@ -67,11 +71,11 @@ int normal_demo(struct notcurses* nc){
goto err;
}
DEMO_RENDER(nc);
demo_nanosleep(nc, &scaled);
}
free(rgba);
rgba = NULL;
struct timespec scaled;
timespec_div(&demodelay, 4, &scaled);
timespec_div(&demodelay, 8, &scaled);
// we can't resize (and thus can't rotate) the standard plane, so dup it
n = ncplane_dup(nstd, NULL);
if(n == NULL){

@ -504,9 +504,7 @@ static int
rotate_merge(ncplane* n, ncplane* newp){
int dimy, dimx;
ncplane_dim_yx(newp, &dimy, &dimx);
fprintf(stderr, "NEWPlen: %d/%d\n", dimy, dimx);
int ret = ncplane_resize(n, 0, 0, 0, 0, 0, 0, dimy, dimx);
fprintf(stderr, "nlen: %d/%d\n", ncplane_dim_y(n), ncplane_dim_x(n));
if(ret == 0){
for(int y = 0 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){

Loading…
Cancel
Save