nodesystem/examples/nodetree/main.c

79 lines
2.5 KiB
C
Raw Permalink Normal View History

2021-01-24 09:54:52 +00:00
#include<stdio.h>
2021-02-07 09:59:00 +00:00
#include "NODESYS/node.h"
#include "NODESYS/node2d.h"
2021-01-24 09:54:52 +00:00
2021-01-24 16:11:49 +00:00
int main(int argc, char* *argv){
NOD_Node *distros = NOD_CreateNode("Distros");
NOD_Node *linoox = NOD_CreateNode("GNU/Linux");
NOD_Node *debian = NOD_CreateNode("Debian");
NOD_Node *ubuntu = NOD_CreateNode("Ubuntu");
NOD_Node *mint = NOD_CreateNode("Linux Mint");
NOD_Node *devuan = NOD_CreateNode("Devuan");
NOD_Node *kali = NOD_CreateNode("Kali Linux");
NOD_Node *voidlinux = NOD_CreateNode("Void Linux");
NOD_Node *arch = NOD_CreateNode("Arch");
NOD_Node *manjaro = NOD_CreateNode("Manjaro");
NOD_Node *parabola = NOD_CreateNode("Parabola");
NOD_Node *endeavouros = NOD_CreateNode("EndeavourOS");
NOD_Node *bsd = NOD_CreateNode("BSD");
NOD_Node *freebsd = NOD_CreateNode("FreeBSD");
NOD_Node *openbsd = NOD_CreateNode("OpenBSD");
NOD_Node *debianbsd = NOD_CreateNode("Debian GNU/kFreeBSD");
2021-02-06 14:20:24 +00:00
NOD_Node2D *point = NOD_CreateNode2D("Point2D");
2021-02-07 06:26:57 +00:00
NOD_Node2D *point2 = NOD_CreateNode2D("Point2D2");
2021-02-06 14:20:24 +00:00
point->pos.x = 2;
2021-02-07 07:41:57 +00:00
point->pos.y = 10;
printf("The X value of '%s' is %d!\n", point->node.name, point->pos.x);
printf("The Y value of '%s' is %d!\n", point->node.name, point->pos.y);
printf("\n");
point2->pos.x = 10;
point2->pos.y = 20;
printf("The X value of '%s' is %d!\n", point2->node.name, point2->pos.x);
printf("The Y value of '%s' is %d!\n", point2->node.name, point2->pos.y);
printf("\n");
2021-02-06 14:20:24 +00:00
2021-02-07 06:26:57 +00:00
NOD_NodeAddChild(point, point2);
2021-02-07 07:41:57 +00:00
printf("The true X value of '%s' is %d!\n", point2->node.name, NOD_GetAbsPosNode2D(point2).x);
printf("The true Y value of '%s' is %d!\n", point2->node.name, NOD_GetAbsPosNode2D(point2).y);
printf("\n");
2021-02-07 06:26:57 +00:00
printf("The parent of '%s' is '%s'.\n", NOD(point2)->name, NOD(NOD(point2)->parent)->name);
NOD_PrintNodeTree(point);
2021-02-06 12:15:27 +00:00
2021-01-24 16:11:49 +00:00
NOD_NodeAddChild(distros, linoox);
NOD_NodeAddChild(distros, bsd);
NOD_NodeAddChild(linoox, debian);
NOD_NodeAddChild(linoox, voidlinux);
NOD_NodeAddChild(linoox, arch);
NOD_NodeAddChild(debian, ubuntu);
NOD_NodeAddChild(debian, kali);
2021-01-24 18:33:20 +00:00
NOD_NodeAddChild(debian, devuan);
2021-01-24 16:11:49 +00:00
NOD_NodeAddChild(ubuntu, mint);
NOD_NodeAddChild(arch, manjaro);
NOD_NodeAddChild(arch, parabola);
NOD_NodeAddChild(arch, endeavouros);
NOD_NodeAddChild(bsd, freebsd);
NOD_NodeAddChild(bsd, openbsd);
NOD_NodeAddChild(bsd, debianbsd);
2021-01-24 16:11:49 +00:00
//NOD_NodeUnparent(child2);
2021-02-06 14:20:24 +00:00
2021-01-24 16:11:49 +00:00
NOD_PrintNodeTree(distros);
2021-02-06 12:15:27 +00:00
NOD_DestroyNodeBranch(distros);
2021-01-24 09:54:52 +00:00
return 0;
}