Update node_t struct definition

This commit is contained in:
2024-01-15 20:03:55 +00:00
parent fc0e3524fe
commit 10ff46cfe4
2 changed files with 37 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
#ifndef NODES_H
#define NODES_H
#include "aliases/aliases.h"
#include "window.h"
#define MAX_NODES 1024
@@ -13,20 +14,27 @@
#define OP_NODE_FILL_COLOUR ((colour_t){.abgr = 0xffad6c3a})
#define OP_NODE_BORDER_COLOUR ((colour_t){.abgr = 0xff8e4a33})
typedef i32 (*node_func_t)(i32 a, i32 b);
typedef enum node_type node_type_t;
typedef union node_data node_data_t;
typedef struct node node_t;
enum comp_ops {
COMP_OP_ADD,
COMP_OP_SUB,
COMP_OP_MUL,
COMP_OP_DIV,
enum node_type {
NODE_TYPE_IO,
NODE_TYPE_OP,
COUNT_COMP_OPS,
COUNT_NODE_TYPES,
};
union node_data {
const char *path;
node_func_t func;
};
struct node {
rect_t rect;
const char *path;
node_type_t type;
node_data_t data;
};
bool aabb(const node_t *node, i32 x, i32 y);