mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
convert remaining ncplane_new -> ncplane_create #1115
This commit is contained in:
parent
3e209f3539
commit
f676cd34a8
@ -108,7 +108,13 @@ slidepanel(struct notcurses* nc, struct ncplane* stdn){
|
|||||||
struct ncplane* l;
|
struct ncplane* l;
|
||||||
|
|
||||||
// First we just create a plane with no styling and no glyphs.
|
// First we just create a plane with no styling and no glyphs.
|
||||||
struct ncplane* n = ncplane_new(stdn, ny, nx, yoff, xoff, NULL, NULL);
|
struct ncplane_options nopts = {
|
||||||
|
.y = yoff,
|
||||||
|
.x = xoff,
|
||||||
|
.rows = ny,
|
||||||
|
.cols = nx,
|
||||||
|
};
|
||||||
|
struct ncplane* n = ncplane_create(stdn, &nopts);
|
||||||
|
|
||||||
// Zero-initialized channels use the default color, opaquely. Since we have
|
// Zero-initialized channels use the default color, opaquely. Since we have
|
||||||
// no glyph, we should show underlying glyphs in the default colors. The
|
// no glyph, we should show underlying glyphs in the default colors. The
|
||||||
|
@ -24,7 +24,13 @@ view_video_demo(struct notcurses* nc){
|
|||||||
|
|
||||||
static struct ncplane*
|
static struct ncplane*
|
||||||
legend(struct ncplane* stdn, int dimy, int dimx){
|
legend(struct ncplane* stdn, int dimy, int dimx){
|
||||||
struct ncplane* n = ncplane_new(stdn, 4, 25, dimy / 8 - 1, (dimx - 25) / 2, NULL, NULL);
|
struct ncplane_options nopts = {
|
||||||
|
.y = dimy / 8 - 1,
|
||||||
|
.x = (dimx - 25) / 2,
|
||||||
|
.rows = 4,
|
||||||
|
.cols = 25,
|
||||||
|
};
|
||||||
|
struct ncplane* n = ncplane_create(stdn, &nopts);
|
||||||
ncplane_set_bg_alpha(n, CELL_ALPHA_TRANSPARENT);
|
ncplane_set_bg_alpha(n, CELL_ALPHA_TRANSPARENT);
|
||||||
uint64_t channels = 0;
|
uint64_t channels = 0;
|
||||||
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
|
channels_set_bg_alpha(&channels, CELL_ALPHA_TRANSPARENT);
|
||||||
@ -63,7 +69,11 @@ view_images(struct notcurses* nc, struct ncplane* nstd, int dimy, int dimx){
|
|||||||
ncplane_erase(nstd);
|
ncplane_erase(nstd);
|
||||||
// standard plane gets PurpleDrank (which will cover the plane), but first
|
// standard plane gets PurpleDrank (which will cover the plane), but first
|
||||||
// serves as a blocker behind dsplane, which gets the DSSCAW logo.
|
// serves as a blocker behind dsplane, which gets the DSSCAW logo.
|
||||||
struct ncplane* dsplane = ncplane_new(nstd, dimy, dimx, 0, 0, NULL, NULL);
|
struct ncplane_options nopts = {
|
||||||
|
.rows = dimy,
|
||||||
|
.cols = dimx,
|
||||||
|
};
|
||||||
|
struct ncplane* dsplane = ncplane_create(nstd, &nopts);
|
||||||
if(dsplane == NULL){
|
if(dsplane == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,13 @@ mathplane(struct notcurses* nc){
|
|||||||
notcurses_term_dim_yx(nc, &dimy, &dimx);
|
notcurses_term_dim_yx(nc, &dimy, &dimx);
|
||||||
const int HEIGHT = 9;
|
const int HEIGHT = 9;
|
||||||
const int WIDTH = dimx;
|
const int WIDTH = dimx;
|
||||||
struct ncplane* n = ncplane_new(stdn, HEIGHT, WIDTH, dimy - HEIGHT - 1, dimx - WIDTH, NULL, NULL);
|
struct ncplane_options nopts = {
|
||||||
|
.y = dimy - HEIGHT - 1,
|
||||||
|
.x = dimx - WIDTH,
|
||||||
|
.rows = HEIGHT,
|
||||||
|
.cols = WIDTH,
|
||||||
|
};
|
||||||
|
struct ncplane* n = ncplane_create(stdn, &nopts);
|
||||||
uint64_t channels = 0;
|
uint64_t channels = 0;
|
||||||
channels_set_fg_rgb(&channels, 0x2b50c8); // metallic gold, inverted
|
channels_set_fg_rgb(&channels, 0x2b50c8); // metallic gold, inverted
|
||||||
channels_set_fg_alpha(&channels, CELL_ALPHA_BLEND);
|
channels_set_fg_alpha(&channels, CELL_ALPHA_BLEND);
|
||||||
@ -524,7 +530,13 @@ int witherworm_demo(struct notcurses* nc){
|
|||||||
if(math == NULL){
|
if(math == NULL){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
struct ncplane* mess = ncplane_new(n, 7, 57, 2, 4, NULL, NULL);
|
struct ncplane_options nopts = {
|
||||||
|
.y = 2,
|
||||||
|
.x = 4,
|
||||||
|
.rows = 7,
|
||||||
|
.cols = 57,
|
||||||
|
};
|
||||||
|
struct ncplane* mess = ncplane_create(n, &nopts);
|
||||||
if(mess == NULL){
|
if(mess == NULL){
|
||||||
ncplane_destroy(math);
|
ncplane_destroy(math);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user