44 lines
877 B
C
44 lines
877 B
C
#ifndef NODES_H
|
|
#define NODES_H
|
|
|
|
#include "aliases/aliases.h"
|
|
#include "window.h"
|
|
|
|
#define MAX_NODES 1024
|
|
|
|
#define NODE_WIDTH 70
|
|
#define NODE_HEIGHT 20
|
|
|
|
#define IO_NODE_FILL_COLOUR ((colour_t){.abgr = 0xff2c84b7})
|
|
#define IO_NODE_BORDER_COLOUR ((colour_t){.abgr = 0xff315c89})
|
|
#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 node_type {
|
|
NODE_TYPE_IO,
|
|
NODE_TYPE_OP,
|
|
|
|
COUNT_NODE_TYPES,
|
|
};
|
|
|
|
union node_data {
|
|
const char *path;
|
|
node_func_t func;
|
|
};
|
|
|
|
struct node {
|
|
rect_t rect;
|
|
node_type_t type;
|
|
node_data_t data;
|
|
};
|
|
|
|
bool aabb(const node_t *node, i32 x, i32 y);
|
|
void draw_node(const window_t *wnd, const node_t *node);
|
|
|
|
#endif // !NODES_H
|