dorne/cli/main.c

70 lines
2.4 KiB
C
Raw Normal View History

2025-09-10 01:25:08 +10:00
#include <fcntl.h>
2025-09-09 19:43:54 +10:00
#include <stdlib.h>
2025-09-10 01:25:08 +10:00
#include <unistd.h>
2025-09-09 15:43:54 +10:00
2025-09-11 17:41:14 +10:00
#include <ncursesw/ncurses.h>
2025-09-13 10:39:58 +10:00
#include "cursetree.h"
2025-09-16 23:08:44 +10:00
#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))
2025-09-09 15:43:54 +10:00
int main(int argc, char **argv) {
struct ct_tree *tree;
ct_init(&tree);
2025-09-11 17:41:14 +10:00
init_pair(1, COLOR_BLACK, COLOR_CYAN);
init_pair(2, COLOR_BLACK, COLOR_RED);
2025-09-16 21:30:14 +10:00
init_pair(3, COLOR_BLACK, COLOR_GREEN);
2025-09-16 23:08:44 +10:00
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);
2025-09-18 12:24:33 +10:00
// 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);
2025-09-18 12:24:33 +10:00
// 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));
2025-09-18 12:24:33 +10:00
// 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));
2025-09-18 12:24:33 +10:00
// 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) {
2025-09-18 12:24:33 +10:00
ct_update(tree);
2025-09-16 23:08:44 +10:00
2025-09-18 12:24:33 +10:00
// 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);
2025-09-16 23:08:44 +10:00
2025-09-18 12:24:33 +10:00
// nprintsfdims(child2, 7, "3_1", child3_1);
// nprintsfdims(child2, 8, "3_2", child3_2);
2025-09-16 23:08:44 +10:00
2025-09-18 12:24:33 +10:00
ct_process(tree);
2025-09-11 19:27:49 +10:00
}
2025-09-11 17:41:14 +10:00
destroy_tree(tree);
2025-09-11 19:27:49 +10:00
2025-09-09 19:43:54 +10:00
return EXIT_SUCCESS;
2025-09-09 15:43:54 +10:00
}