fixed missing gaps showing

This commit is contained in:
Emile Clark-Boman 2025-09-16 23:08:44 +10:00
parent dce97e6b3e
commit 9a6786b2b5
3 changed files with 58 additions and 80 deletions

View file

@ -5,6 +5,12 @@
#include <ncursesw/ncurses.h>
#include "cursetree.h"
#include "surface.h"
#define nprintsfdims(nout, i, label, nin) \
(mvwprintw((nout)->surface->win, (i), 0, "%s@(%d,%d) %dx%d", (label), \
(nin)->surface->dims->x, (nin)->surface->dims->y, \
(nin)->surface->dims->width, (nin)->surface->dims->height))
int main(int argc, char **argv) {
struct ct_tree *tree;
@ -13,37 +19,47 @@ int main(int argc, char **argv) {
init_pair(1, COLOR_BLACK, COLOR_CYAN);
init_pair(2, COLOR_BLACK, COLOR_RED);
init_pair(3, COLOR_BLACK, COLOR_GREEN);
// wbkgd(tree->root->surface->win, COLOR_PAIR(1));
// wrefresh(tree->root->surface->win);
init_pair(4, COLOR_BLACK, COLOR_MAGENTA);
init_pair(5, COLOR_BLACK, COLOR_YELLOW);
struct ct_node *const child1 = new_node(bounds_none(), tree->root);
struct ct_node *const child2 = new_node(bounds_none(), tree->root);
struct ct_node *const child3 = new_node(bounds_none(), tree->root);
struct ct_node *const child4 = new_node(bounds_none(), tree->root);
struct ct_node *const child5 = new_node(bounds_none(), tree->root);
append_child_node(tree->root, child1);
append_child_node(tree->root, child2);
append_child_node(tree->root, child3);
append_child_node(tree->root, child4);
append_child_node(tree->root, child5);
wbkgd(child1->surface->win, COLOR_PAIR(1));
wbkgd(child2->surface->win, COLOR_PAIR(2));
wbkgd(child3->surface->win, COLOR_PAIR(3));
wbkgd(child4->surface->win, COLOR_PAIR(4));
wbkgd(child5->surface->win, COLOR_PAIR(5));
// wrefresh(child1->surface->win);
mvwprintw(child2->surface->win, 0, 0, "1@(%d,%d) %dx%d\n",
child1->surface->dims->x, child1->surface->dims->y,
child1->surface->dims->width, child1->surface->dims->height);
mvwprintw(child2->surface->win, 1, 0, "2@(%d,%d) %dx%d\n",
child2->surface->dims->x, child2->surface->dims->y,
child2->surface->dims->width, child2->surface->dims->height);
mvwprintw(child2->surface->win, 1, 0, "2@(%d,%d) %dx%d\n",
child3->surface->dims->x, child3->surface->dims->y,
child3->surface->dims->width, child3->surface->dims->height);
child3->axis = AXIS_Y;
struct ct_node *const child3_1 = new_node(bounds_none(), child3);
struct ct_node *const child3_2 = new_node(bounds_none(), child3);
append_child_node(child3, child3_1);
append_child_node(child3, child3_2);
wbkgd(child3_1->surface->win, COLOR_PAIR(1));
wbkgd(child3_2->surface->win, COLOR_PAIR(5));
while (1) {
nprintsfdims(child2, 0, "R", tree->root);
nprintsfdims(child2, 1, "1", child1);
nprintsfdims(child2, 2, "2", child2);
nprintsfdims(child2, 3, "3", child3);
nprintsfdims(child2, 4, "4", child4);
nprintsfdims(child2, 5, "5", child5);
nprintsfdims(child2, 7, "3_1", child3_1);
nprintsfdims(child2, 8, "3_2", child3_2);
ct_update(tree);
// napms(100);
}
destroy_tree(tree);