From 3e209f35394a3510d255c98125ee9e1288d4863e Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 15 Nov 2020 01:03:50 -0500 Subject: [PATCH] eagle, luigi, sliders, outro: ncplane_create #1115 --- src/demo/eagle.c | 14 ++++++++++++-- src/demo/fallin.c | 8 +++++++- src/demo/luigi.c | 7 ++++++- src/demo/outro.c | 7 ++++++- src/demo/reel.c | 8 +++++++- src/demo/sliding.c | 10 +++++++--- 6 files changed, 45 insertions(+), 9 deletions(-) diff --git a/src/demo/eagle.c b/src/demo/eagle.c index 2328ac34a..d52f71e06 100644 --- a/src/demo/eagle.c +++ b/src/demo/eagle.c @@ -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; } diff --git a/src/demo/fallin.c b/src/demo/fallin.c index 2287c3055..e4567c9d2 100644 --- a/src/demo/fallin.c +++ b/src/demo/fallin.c @@ -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; } diff --git a/src/demo/luigi.c b/src/demo/luigi.c index 8be0fc215..fc5b6fd1e 100644 --- a/src/demo/luigi.c +++ b/src/demo/luigi.c @@ -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]); diff --git a/src/demo/outro.c b/src/demo/outro.c index 3427c7f86..252696a47 100644 --- a/src/demo/outro.c +++ b/src/demo/outro.c @@ -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); diff --git a/src/demo/reel.c b/src/demo/reel.c index 796b76263..9ae818041 100644 --- a/src/demo/reel.c +++ b/src/demo/reel.c @@ -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; } diff --git a/src/demo/sliding.c b/src/demo/sliding.c index a2a762afd..3bdfbd4b9 100644 --- a/src/demo/sliding.c +++ b/src/demo/sliding.c @@ -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; }