diff --git a/resources/block.svg b/resources/block.svg
new file mode 100644
index 0000000..47ef9f8
--- /dev/null
+++ b/resources/block.svg
@@ -0,0 +1,73 @@
+
+
+
+
diff --git a/resources/delete.svg b/resources/delete.svg
new file mode 100644
index 0000000..2f42747
--- /dev/null
+++ b/resources/delete.svg
@@ -0,0 +1,81 @@
+
+
+
+
diff --git a/resources/split.svg b/resources/split.svg
new file mode 100644
index 0000000..ea23a2a
--- /dev/null
+++ b/resources/split.svg
@@ -0,0 +1,87 @@
+
+
+
+
diff --git a/resources/textures.svg b/resources/textures.svg
new file mode 100644
index 0000000..2f42747
--- /dev/null
+++ b/resources/textures.svg
@@ -0,0 +1,81 @@
+
+
+
+
diff --git a/resources/textures/round-delete.png b/resources/textures/delete.png
similarity index 100%
rename from resources/textures/round-delete.png
rename to resources/textures/delete.png
diff --git a/resources/textures/split.png b/resources/textures/split.png
new file mode 100644
index 0000000..a5bb9b5
Binary files /dev/null and b/resources/textures/split.png differ
diff --git a/src/app-manager.cpp b/src/app-manager.cpp
index da73ef0..6f0a0d4 100644
--- a/src/app-manager.cpp
+++ b/src/app-manager.cpp
@@ -154,8 +154,8 @@ namespace VISEQ::APP{
canvas->drawStart();
canvas->draw();
- gm->drawNodes(SCREEN_MOUSE, canvas->camera);
gm->drawEdges(SCREEN_MOUSE, canvas->camera);
+ gm->drawNodes(SCREEN_MOUSE, canvas->camera);
sm->drawSignals(SCREEN_MOUSE, canvas->camera);
im.draw();
diff --git a/src/button.h b/src/button.h
index dde5db0..c71e7fb 100644
--- a/src/button.h
+++ b/src/button.h
@@ -16,7 +16,7 @@ inline bool ViTexButton(Vec2Df mp, Vec2Df position, float rotation, float radius
float scale = (radius*2.0f) / (float)tex.width;
Vec2Df start_position = position - Vec2Df((tex.width*scale) / 2.0f, (tex.height*scale) / 2.0f);
Vec2Df center_pos = start_position.rotateAround(position, rotation);
- DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0,tex.height*scale/2.0f), rotation, color);
+ DrawTexturePro(tex, Rectangle(0.0, 0.0, tex.width, tex.height), Rectangle(center_pos.x, center_pos.y, tex.width*scale, tex.height*scale), Vec2Df(0.0f,tex.height*scale/2.0f), rotation, color);
return (Vector2Distance(mp, position) < radius && IsMouseButtonPressed(MOUSE_BUTTON_LEFT));
}
diff --git a/src/edge.h b/src/edge.h
index 24517f2..16dbb6f 100644
--- a/src/edge.h
+++ b/src/edge.h
@@ -32,7 +32,7 @@ namespace VISEQ::GRAPH::EDGES {
float speed = 0;
float bpm = 120.0f;
- float connector_offset = 8.0f;
+ float connector_offset = 2.0f;
float switches_offset = 25.0f;
virtual bool GActive();
diff --git a/src/graph-manager.cpp b/src/graph-manager.cpp
index 569cf61..36e262c 100644
--- a/src/graph-manager.cpp
+++ b/src/graph-manager.cpp
@@ -31,7 +31,8 @@ namespace VISEQ::GRAPH{
}
void GraphManager::loadTextures(){
- tex_delete = LoadTexture("resources/textures/round-delete.png");
+ tex_delete = LoadTexture("resources/textures/delete.png");
+ tex_split = LoadTexture("resources/textures/split.png");
}
int GraphManager::getNodesSize(){
@@ -359,29 +360,30 @@ namespace VISEQ::GRAPH{
float v1_v2_distance = v1_position.dist(&v2_position);
if(v1_v2_distance < 100) c->switches_offset = v1_v2_distance/2.3f;
- Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm() * (c->start.lock()->radius + c->switches_offset);
- Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm() * (c->end.lock()->radius + c->switches_offset);
- Vec2Df middle_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.4f;
- Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.6f;
+ Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*40.0f; //.norm() * (c->start.lock()->radius + c->switches_offset);
+ Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*40.0f; //.norm() * (c->end.lock()->radius + c->switches_offset);
+ Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*60.0f;
+ Vec2Df middle_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*60.0f;
+ Vec2Df center_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.5f;
Vec2Df flip_handle = middle_handle + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*0.2, 0.f, 20.f) : 1.0f);
Vec2Df flip_handle_2 = middle_handle_2 + (v1_position - v2_position).norm().orth() * (v1_v2_distance < 120.0f ? Clamp((120.0f - v1_v2_distance)*-0.2, -20.f, 0.f) : 1.0f);
// Dynamic opacity by distance to mouse
- unsigned char opacity = 150.0f - Clamp(middle_handle.dist(mouse_pos), 0.0f, 150.0f);
- unsigned char opacity_from = 250.0f - Clamp(from_to_handle.dist(mouse_pos), 0.0f, 220.0f);
- unsigned char opacity_to = 250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
+ unsigned char opacity = 200.0f; //150.0f - Clamp(middle_handle.dist(mouse_pos), 0.0f, 150.0f);
+ unsigned char opacity_from = 200.0f; //250.0f - Clamp(from_to_handle.dist(mouse_pos), 0.0f, 220.0f);
+ unsigned char opacity_to = 200.0f; //250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
- float opacity_normalized = Clamp((float)opacity / 255.0f, .0f, 1.0f);
+ float opacity_normalized = 0.80f; //Clamp((float)opacity / 255.0f, .0f, 1.0f);
- float midi_gate_v1 = 0.0f;
- float midi_gate_v2 = 0.0f;
+ // float midi_gate_v1 = 0.0f;
+ // float midi_gate_v2 = 0.0f;
- if(c->start.lock()->getNodeType() == NodeType::MIDINODE){
- midi_gate_v1 = Clamp((4.f / 1000.f) * std::dynamic_pointer_cast(c->start.lock())->getNotes().gate, 1.f, 4.f);
- }
- if(c->end.lock()->getNodeType() == NodeType::MIDINODE){
- midi_gate_v2 = Clamp((4.f / 1000.f) * std::dynamic_pointer_cast(c->end.lock())->getNotes().gate, 1.f, 4.f);
- }
+ // if(c->start.lock()->getNodeType() == NodeType::MIDINODE){
+ // midi_gate_v1 = Clamp((4.f / 1000.f) * std::dynamic_pointer_cast(c->start.lock())->getNotes().gate, 1.f, 4.f);
+ // }
+ // if(c->end.lock()->getNodeType() == NodeType::MIDINODE){
+ // midi_gate_v2 = Clamp((4.f / 1000.f) * std::dynamic_pointer_cast(c->end.lock())->getNotes().gate, 1.f, 4.f);
+ // }
// Line with small connector circles
if(c->end.lock()->getNodeType() == NodeType::MIDINODE && c->start.lock()->getNodeType() == NodeType::MIDINODE){
@@ -394,8 +396,8 @@ namespace VISEQ::GRAPH{
Vector2 text_length = MeasureTextEx(GetFontDefault(), std::format("{:.1f}",d).c_str(), 10.0f, 2.0f);
Vector2 text_length_frac = MeasureTextEx(GetFontDefault(), frac.c_str(), 10.0f, 2.0f);
- Vec2Df middle_handle = c->start.lock()->position + (c->end.lock()->position - c->start.lock()->position) * ((d - text_length.x)*0.5f)/d;
- Vec2Df middle_handle_frac = c->start.lock()->position + (c->end.lock()->position - c->start.lock()->position) * ((d - text_length_frac.x)*0.5f)/d;
+ Vec2Df middle_handle = c->start.lock()->position + (c->end.lock()->position - c->start.lock()->position) * ((d - text_length.x)*0.35f)/d;
+ Vec2Df middle_handle_frac = c->start.lock()->position + (c->end.lock()->position - c->start.lock()->position) * ((d - text_length_frac.x)*0.35f)/d;
Vec2Df text_position = middle_handle + (c->start.lock()->position - c->end.lock()->position).norm().orth() * 12.0f;
Vec2Df text_position_frac = middle_handle_frac - (c->start.lock()->position - c->end.lock()->position).norm().orth() * 4.0f;
@@ -403,12 +405,12 @@ namespace VISEQ::GRAPH{
DrawTextPro(GetFontDefault(), std::format("{:.1f}",d).c_str(), text_position, (Vector2){0,0}, rotation, 10.0f, 2.0f, VS_COLOR_PINK);
if( (int)d % 60 == 0) DrawTextPro(GetFontDefault(), frac.c_str(), text_position_frac, (Vector2){0,0}, rotation, 10.0f, 2.0f, VS_COLOR_PINK);
}
- if(midi_gate_v1 == 4.0f) col = VS_COLOR_RED;
- DrawCircle(v1_position.x, v1_position.y, midi_gate_v1, col);
-
- col = {229, 181, 103, 255};
- if(midi_gate_v2 == 4.0f) col = VS_COLOR_RED;
- DrawCircle(v2_position.x, v2_position.y, midi_gate_v2, col);
+ // if(midi_gate_v1 == 4.0f) col = VS_COLOR_RED;
+ // DrawCircle(v1_position.x, v1_position.y, midi_gate_v1, col);
+ //
+ // col = {229, 181, 103, 255};
+ // if(midi_gate_v2 == 4.0f) col = VS_COLOR_RED;
+ // DrawCircle(v2_position.x, v2_position.y, midi_gate_v2, col);
if(!c->start.lock()->picked_up && !c->end.lock()->picked_up){
// On/Off switches on both sides
@@ -426,15 +428,17 @@ namespace VISEQ::GRAPH{
Vec2Df block_point2 = (v1_position - v2_position).norm().orth()*-4.0f + to_from_handle;
DrawLineEx(block_point1, block_point2, 2.0f, (Color){232,232,232,opacity_to});
}
-
- if(ViButton(mouse_pos, flip_handle_2.x, flip_handle_2.y, 8.0f, (Color){232, 125, 62, opacity} )) splitEdge(c);
+ if(IsWindowReady()){
+ if(ViTexButton(mouse_pos, center_handle, HELPER::GetRotation(from_to_handle, to_from_handle) + 90.0f, 8.0f, tex_split, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) splitEdge(c);
+ }
}
}
if(c->start.lock()->getNodeType() == NodeType::CONFIGNODE || c->end.lock()->getNodeType() == NodeType::CONFIGNODE){
DrawLine(v1_position.x, v1_position.y, v2_position.x, v2_position.y, VS_COLOR_BLUE);
}
if(IsWindowReady()){
- if(ViTexButton(mouse_pos, flip_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
+ if(ViTexButton(mouse_pos, middle_handle, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
+ if(ViTexButton(mouse_pos, middle_handle_2, HELPER::GetRotation(from_to_handle, to_from_handle), 8.0f, tex_delete, ColorLerp(Fade(VS_COLOR_WHITE, .0f), Fade(VS_COLOR_WHITE, 1.0f), opacity_normalized) )) removeEdge(c);
}
}
}
diff --git a/src/graph-manager.h b/src/graph-manager.h
index 42a185c..ef25773 100644
--- a/src/graph-manager.h
+++ b/src/graph-manager.h
@@ -87,6 +87,7 @@ namespace VISEQ::GRAPH {
friend void to_json(json& j, const std::shared_ptr& G);
Texture2D tex_delete;
+ Texture2D tex_split;
};
}
diff --git a/src/node.cpp b/src/node.cpp
index 4dc25bf..bc0a15d 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -76,11 +76,10 @@ namespace VISEQ::GRAPH::NODES {
void Node::cycleMode(bool direction){
if(direction){
- mode = (mode + 1) % 7;
+ mode = (mode + 1) % 6;
} else {
- mode -= mode > 0 ? 1 : -6;
+ mode -= mode > 0 ? 1 : -5;
}
- std::cout << "mode changed to: " << mode << std::endl;
}
void to_json(json& j, const Node& N){