small steps forward - placement of edge buttons changed and one more texture added

This commit is contained in:
Sebastian
2026-06-27 01:35:20 +02:00
parent 970faad32d
commit e4b2df21bc
12 changed files with 360 additions and 34 deletions
+73
View File
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg1"
inkscape:export-filename="round-delete.png"
inkscape:export-xdpi="24"
inkscape:export-ydpi="24"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="block.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showguides="true"
inkscape:zoom="1.1398148"
inkscape:cx="87.294883"
inkscape:cy="268.026"
inkscape:window-width="2560"
inkscape:window-height="1414"
inkscape:window-x="2560"
inkscape:window-y="1106"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<sodipodi:guide
position="0,256"
orientation="0,1"
id="guide1"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,134,229)" />
<sodipodi:guide
position="256,256"
orientation="1,0"
id="guide2"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:#b4d273;fill-opacity:1"
id="path2"
cx="256"
cy="256"
r="256" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd;stroke-width:0.950718"
id="rect2"
width="379.43814"
height="45.092152"
x="-445.71915"
y="233.45386"
transform="rotate(-90)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg1"
inkscape:export-filename="round-delete.png"
inkscape:export-xdpi="24"
inkscape:export-ydpi="24"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="textures.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showguides="true"
inkscape:zoom="1.1398148"
inkscape:cx="87.73355"
inkscape:cy="268.026"
inkscape:window-width="2560"
inkscape:window-height="1414"
inkscape:window-x="2560"
inkscape:window-y="1106"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<sodipodi:guide
position="0,256"
orientation="0,1"
id="guide1"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,134,229)" />
<sodipodi:guide
position="256,256"
orientation="1,0"
id="guide2"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:#c35355;fill-opacity:1"
id="path2"
cx="256"
cy="256"
r="256" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
id="rect2"
width="419.79556"
height="45.092152"
x="-571.93646"
y="-22.546076"
transform="rotate(-135)" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
id="rect2-0"
width="419.79556"
height="45.092152"
x="-209.89778"
y="339.49261"
transform="rotate(-45)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

+87
View File
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg1"
inkscape:export-filename="textures/split.png"
inkscape:export-xdpi="24"
inkscape:export-ydpi="24"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="split.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showguides="true"
inkscape:zoom="1.6119415"
inkscape:cx="67.930503"
inkscape:cy="246.59703"
inkscape:window-width="2560"
inkscape:window-height="1414"
inkscape:window-x="2560"
inkscape:window-y="1106"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<sodipodi:guide
position="0,256"
orientation="0,1"
id="guide1"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,134,229)" />
<sodipodi:guide
position="256,256"
orientation="1,0"
id="guide2"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#b4d273;fill-opacity:1;fill-rule:evenodd;stroke-width:0.742756"
id="rect1"
width="282.46313"
height="512"
x="114.76843"
y="0"
ry="141.23157" />
<circle
style="fill:#b4d273;fill-opacity:1"
id="path2"
cx="-409.89764"
cy="256"
r="256" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
id="rect2"
width="419.79556"
height="45.092152"
x="-465.89786"
y="233.45387"
transform="rotate(-90.000013)" />
<circle
style="fill:#d6d6d6;fill-opacity:1;stroke-width:0.283738"
id="path2-7"
cx="256"
cy="256"
r="72.636879" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

+81
View File
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="512"
height="512"
viewBox="0 0 512 512"
version="1.1"
id="svg1"
inkscape:export-filename="round-delete.png"
inkscape:export-xdpi="24"
inkscape:export-ydpi="24"
inkscape:version="1.4.4 (dcaf3e7d9e, 2026-05-05)"
sodipodi:docname="textures.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showguides="true"
inkscape:zoom="1.1398148"
inkscape:cx="87.73355"
inkscape:cy="268.026"
inkscape:window-width="2560"
inkscape:window-height="1414"
inkscape:window-x="2560"
inkscape:window-y="1106"
inkscape:window-maximized="1"
inkscape:current-layer="layer1">
<sodipodi:guide
position="0,256"
orientation="0,1"
id="guide1"
inkscape:locked="false"
inkscape:label=""
inkscape:color="rgb(0,134,229)" />
<sodipodi:guide
position="256,256"
orientation="1,0"
id="guide2"
inkscape:locked="false" />
</sodipodi:namedview>
<defs
id="defs1" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="fill:#c35355;fill-opacity:1"
id="path2"
cx="256"
cy="256"
r="256" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
id="rect2"
width="419.79556"
height="45.092152"
x="-571.93646"
y="-22.546076"
transform="rotate(-135)" />
<rect
style="fill:#d6d6d6;fill-opacity:1;fill-rule:evenodd"
id="rect2-0"
width="419.79556"
height="45.092152"
x="-209.89778"
y="339.49261"
transform="rotate(-45)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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));
}
+1 -1
View File
@@ -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();
+32 -28
View File
@@ -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<MidiNode>(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<MidiNode>(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<MidiNode>(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<MidiNode>(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);
}
}
}
+1
View File
@@ -87,6 +87,7 @@ namespace VISEQ::GRAPH {
friend void to_json(json& j, const std::shared_ptr<GraphManager>& G);
Texture2D tex_delete;
Texture2D tex_split;
};
}
+2 -3
View File
@@ -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){