two direction connections with blockers working

This commit is contained in:
Sebastian
2024-10-15 02:59:26 +02:00
parent 313bf767c6
commit b74c63a115
5 changed files with 101 additions and 33 deletions
+11 -11
View File
@@ -22,19 +22,19 @@ class Node : public Movable{
bool hover_connect = false;
bool connecting = false;
int next = 0;
// int next = 0;
int midi_out = 0;
int midi_note = 0;
int midi_cc = 0;
std::vector<Node*> connections;
// std::vector<Node*> connections;
Node* get_next(){
next = (next+1) % connections.size();
return connections[next];
}
/*Node* get_next(){*/
/* next = (next+1) % connections.size();*/
/* return connections[next];*/
/*}*/
void draw(Vec2D<float> *mouse) {
if(!hover_move) DrawCircle(position.x, position.y, radius, (Color){180, 210, 115, 255});
@@ -42,11 +42,11 @@ class Node : public Movable{
Vec2D<float> connector = position - ((position - *mouse)).norm() * (radius + R);
for(auto& to : connections){
Vec2D<float> from_position = position - ((position - to->position)).norm() * (radius + 10.0f);
Vec2D<float> to_position = to->position - ((to->position - position)).norm() * (to->radius + 10.0f);
DrawLine(from_position.x, from_position.y, to_position.x, to_position.y, (Color){229, 181, 103, 255});
}
/*for(auto& to : connections){*/
/* Vec2D<float> from_position = position - ((position - to->position)).norm() * (radius + 10.0f);*/
/* Vec2D<float> to_position = to->position - ((to->position - position)).norm() * (to->radius + 10.0f);*/
/* DrawLine(from_position.x, from_position.y, to_position.x, to_position.y, (Color){229, 181, 103, 255});*/
/*}*/
if(hover_connect){
DrawCircleLines(position.x, position.y, radius + R, (Color){108, 153, 187, 255});