69 lines
2.4 KiB
C
69 lines
2.4 KiB
C
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
|
|
#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;
|
|
ct_init(&tree);
|
|
|
|
init_pair(1, COLOR_BLACK, COLOR_CYAN);
|
|
init_pair(2, COLOR_BLACK, COLOR_RED);
|
|
init_pair(3, COLOR_BLACK, COLOR_GREEN);
|
|
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));
|
|
|
|
// 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) {
|
|
ct_update(tree);
|
|
|
|
// 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_process(tree);
|
|
}
|
|
|
|
destroy_tree(tree);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|