Files
Nomi/source/nomi.h
2025-11-06 15:04:01 -08:00

109 lines
2.3 KiB
C

/*##############################################################################
* project: nomi
* file: nomi.h
*
* This file handles all of the nomi spesific action like creating and handling
* Trunks and branches. As well as the data nessary for that it to run properly.
*
* Auther: PreacherDHM
* Date: 10/30/2025
*##############################################################################
*/
#ifndef NOMI_H
#define NOMI_H
#include "tart.h"
#define BRNACH 0x01
#define TRUNK 0x00
#define MAX_CHILDREN 5
#define MAX_BRANCHES 30
#include <stdio.h>
typedef unsigned int branchId;
typedef struct {
double x;
double y;
} nomi_vec2;
typedef struct {
nomi_vec2 start;
nomi_vec2 c0;
nomi_vec2 c1;
nomi_vec2 end;
} nomi_curve;
// All of the different notes
typedef struct {
char* text; // This is the data that is in that branch
branchId id; // This holds the branch id.
branchId navId[MAX_BRANCHES];
branchId depth;
branchId children[MAX_CHILDREN]; // holds the branchIds of its children
branchId childrenCount;
struct tart_cell cell;
void* parent; // points the the branches parent
char type; // holds the type as in if this struct is a branch or a trunk
float angle;
nomi_vec2 startPos; // the starting position of the branch
nomi_curve curve;
} branch;
// The Root of the tree structure
typedef struct {
branch branches[MAX_BRANCHES];
branchId branchCount;
const char* title;
char* text;
} trunk;
/*
* This will Init Nomi
*/
void NomiInit(trunk* tr);
branchId* NomiNavigation(char input);
/*
* This will create the truk of the note.
* */
trunk CreateTrunk(char* title, branch root);
void DrawTrunk(trunk* tr, struct tart_window* w, tart_byte b);
/*
* This is a test
* */
void AddBranch(trunk* t, branch br);
/*
* Locate Branch
* */
branchId* LocateBranch(trunk* t);
branch create_branch(branch* parent, nomi_vec2 d, unsigned char percent, unsigned char b);
/*
* Draw Branch
*/
void DrawBranch(branch* branch,unsigned char p, struct tart_window* w, tart_byte b);
/*
* Create Nomi File
*
* name: the name of the file that will be created.
*/
FILE CreateNomiFile(const char* name);
/*
* Save Nomi File
*
* file: the pointer to the nomi file.
*/
void SaveNomiFile(FILE* file);
#endif // NOMI_H