Add support for maintaining connected noodle when parent node moves

This commit is contained in:
2024-02-25 21:04:10 +00:00
parent f2faa56e5f
commit 8078a72deb
3 changed files with 30 additions and 20 deletions

View File

@@ -7,11 +7,13 @@
#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,
@@ -25,13 +27,18 @@ union node_data {
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;
line *noodles;
noodle *noodles;
};
#endif // !NODES_H

View File

@@ -7,8 +7,6 @@
#include <stdbool.h>
#define MAX_UI_ELEMENTS 8192
#define RESERVED_UI_SLOT 0
#define UI_ELEM_START_INDEX 1
#define BUTTON_WIDTH 100
#define BUTTON_HEIGHT 40