45 lines
664 B
C
45 lines
664 B
C
#ifndef NODES_H
|
|
#define NODES_H
|
|
|
|
#include "aliases.h"
|
|
#include "ui.h"
|
|
|
|
#define MAX_NODES 1024
|
|
#define IO_INPUT_COUNT 0
|
|
#define OP_INPUT_COUNT 2
|
|
#define EMPTY_NODE 0
|
|
|
|
typedef i32 (*node_func)(i32 a, i32 b);
|
|
typedef enum node_type node_type;
|
|
typedef union node_data node_data;
|
|
typedef struct node node;
|
|
typedef struct noodle noodle;
|
|
|
|
enum node_type {
|
|
NODE_TYPE_IO,
|
|
NODE_TYPE_OP,
|
|
|
|
COUNT_NODE_TYPES,
|
|
};
|
|
|
|
union node_data {
|
|
const char *path;
|
|
node_func func;
|
|
};
|
|
|
|
struct noodle {
|
|
line ln;
|
|
u64 connected_node;
|
|
};
|
|
|
|
struct node {
|
|
rect rec;
|
|
ui_elem_colours colours;
|
|
node_type type;
|
|
node_data data;
|
|
u64 inputs;
|
|
noodle *noodles;
|
|
};
|
|
|
|
#endif // !NODES_H
|