pixel poc: add vertical movement

This commit is contained in:
nick black 2021-03-20 13:57:40 -04:00 committed by Nick Black
parent 2bd7fa33ff
commit 4f4175098a

View File

@ -10,26 +10,29 @@ handle(struct notcurses* nc, const char *fn){
} }
int dimy, dimx; int dimy, dimx;
struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx); struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx);
for(int x = 0 ; x < dimx ; x += 15){ for(int y = 0 ; y < dimy ; y += 15){
uint64_t channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140); for(int x = 0 ; x < dimx ; x += 15){
ncplane_set_base(stdn, "a", 0, channels); uint64_t channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
struct ncvisual_options vopts = { ncplane_set_base(stdn, "a", 0, channels);
.x = x, struct ncvisual_options vopts = {
.scaling = NCSCALE_NONE_HIRES, .y = y,
.blitter = NCBLIT_PIXEL, .x = x,
}; .scaling = NCSCALE_NONE_HIRES,
struct ncplane* nv = ncvisual_render(nc, ncv, &vopts); .blitter = NCBLIT_PIXEL,
if(nv == NULL){ };
ncvisual_destroy(ncv); struct ncplane* nv = ncvisual_render(nc, ncv, &vopts);
return -1; if(nv == NULL){
ncvisual_destroy(ncv);
return -1;
}
notcurses_render(nc);
sleep(1);
channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
ncplane_set_base(stdn, "a", 0, channels);
notcurses_render(nc);
sleep(1);
ncplane_destroy(nv);
} }
notcurses_render(nc);
sleep(1);
channels = CHANNELS_RGB_INITIALIZER(random() % 256, random() % 256, 100, random() % 256, 100, 140);
ncplane_set_base(stdn, "a", 0, channels);
notcurses_render(nc);
sleep(1);
ncplane_destroy(nv);
} }
ncvisual_destroy(ncv); ncvisual_destroy(ncv);
return 0; return 0;