eagle, luigi, sliders, outro: ncplane_create #1115

pull/1128/head
nick black 4 years ago committed by Nick Black
parent e8224dfa35
commit 3e209f3539

@ -81,7 +81,11 @@ zoom_map(struct notcurses* nc, const char* map, int* ret){
while(vheight > truey || vwidth > truex){
*ret = -1;
ncplane_destroy(zncp);
if((zncp = ncplane_new(n, truey, truex, 0, 0, NULL, NULL)) == NULL){
struct ncplane_options nopts = {
.rows = truey,
.cols = truex,
};
if((zncp = ncplane_create(n, &nopts)) == NULL){
ncvisual_destroy(ncv);
return NULL;
}
@ -162,7 +166,13 @@ eagles(struct notcurses* nc, struct ncplane* n){
for(size_t i = 0 ; i < sizeof(e) / sizeof(*e) ; ++i){
e[i].xoff = 0;
e[i].yoff = random() % ((truey - height) / 2);
e[i].n = ncplane_new(n, height, width, e[i].yoff, e[i].xoff, NULL, NULL);
struct ncplane_options nopts = {
.y = e[i].yoff,
.x = e[i].xoff,
.rows = height,
.cols = width,
};
e[i].n = ncplane_create(n, &nopts);
if(e[i].n == NULL){
return -1;
}

@ -128,7 +128,13 @@ int fallin_demo(struct notcurses* nc){
if(y + newy >= dimy){
newy = dimy - y;
}
struct ncplane* n = ncplane_new(stdn, newy, newx, y, x, NULL, NULL);
struct ncplane_options nopts = {
.y = y,
.x = x,
.rows = newy,
.cols = newx,
};
struct ncplane* n = ncplane_create(stdn, &nopts);
if(n == NULL){
goto err;
}

@ -168,7 +168,12 @@ int luigi_demo(struct notcurses* nc){
int i;
struct ncplane* lastseen = NULL;
for(i = 0 ; i < 3 ; ++i){
lns[i] = ncplane_new(notcurses_stdplane(nc), height, 16, yoff, 0, NULL, NULL);
struct ncplane_options nopts = {
.y = yoff,
.rows = height,
.cols = 16,
};
lns[i] = ncplane_create(notcurses_stdplane(nc), &nopts);
if(lns[i] == NULL){
while(i--){
ncplane_destroy(lns[i]);

@ -81,7 +81,12 @@ videothread(void* vnc){
}
ncfadectx_free(samoactx);
ncplane_destroy(vopts.n);
struct ncplane* apiap = ncplane_new(ncp, 1, cols, 1, 0, NULL, NULL);
struct ncplane_options nopts = {
.y = 1,
.rows = 1,
.cols = cols,
};
struct ncplane* apiap = ncplane_create(ncp, &nopts);
if(apiap == NULL){
ncfadectx_free(samoactx);
ncplane_destroy(vopts.n);

@ -195,7 +195,13 @@ ncreel_demo_core(struct notcurses* nc){
int x = 8, y = 4;
int dimy, dimx;
struct ncplane* std = notcurses_stddim_yx(nc, &dimy, &dimx);
struct ncplane* n = ncplane_new(std, dimy - 12, dimx - 16, y, x, NULL, NULL);
struct ncplane_options nopts = {
.y = y,
.x = x,
.rows = dimy - 12,
.cols = dimx - 16,
};
struct ncplane* n = ncplane_create(std, &nopts);
if(n == NULL){
return -1;
}

@ -169,9 +169,13 @@ int sliding_puzzle_demo(struct notcurses* nc){
for(cy = 0 ; cy < CHUNKS_VERT ; ++cy){
for(cx = 0 ; cx < CHUNKS_HORZ ; ++cx){
const int idx = cy * CHUNKS_HORZ + cx;
chunks[idx] =
ncplane_new(n, chunky, chunkx, cy * chunky + wastey + 1,
cx * chunkx + wastex + 1, NULL, NULL);
struct ncplane_options nopts = {
.y = cy * chunky + wastey + 1,
.x = cx * chunkx + wastex + 1,
.rows = chunky,
.cols = chunkx,
};
chunks[idx] = ncplane_create(n, &nopts);
if(chunks[idx] == NULL){
goto done;
}

Loading…
Cancel
Save