This commit is contained in:
Sebastian
2024-10-18 01:27:14 +02:00
parent add8749bb9
commit d1542870d5
4 changed files with 27 additions and 12 deletions
+16 -7
View File
@@ -39,6 +39,7 @@
#include "connection-manager.h"
libremidi::observer obs;
std::vector<libremidi::midi_out> midi_outs;
libremidi::midi_out midi_out;
std::vector<libremidi::input_port> midi_in_ports;
@@ -107,7 +108,7 @@ int main(){
signals[i].next = &nodes.front();
signals[i].last = &nodes.front();
}
midi_out.open_port(midi_out_ports[2]);
Vec2D<float> drag_offset;
@@ -138,7 +139,7 @@ int main(){
bool dragging = false;
for(auto& n : nodes){
Vec2D<float> connector_position = n.position - ((n.position - mouse_pos)).norm() * (n.radius + 10.0f);
Vec2D<float> connector_position = n.position - ((n.position - mouse_pos)).norm() * (n.radius + 14.0f);
float dist_connector = (connector_position - mouse_pos).length();
float dist = (n.position - mouse_pos).length();
@@ -150,7 +151,7 @@ int main(){
n.hover_connect = false;
}
if(dist_connector <= 6.0f && mouse_clicked && !connecting) {
if(dist_connector <= 8.0f && mouse_clicked && !connecting) {
connecting_from = &n;
n.connecting = true;
connecting = true;
@@ -228,12 +229,20 @@ int main(){
for(auto& n : nodes){
if(n.config){
n.config = !GuiWindowBox((Rectangle){n.position.x + 10, n.position.y + 10,200,300}, "config");
int option = n.mode;
GuiComboBox((Rectangle){ 20, 100, 240, 20 }, "Round Robin;Random", &option);
GuiComboBox((Rectangle){ n.position.x + 20, n.position.y + 40, 200, 20 }, "Round Robin;Random", &option);
n.mode = (Distribution)option;
if(GuiButton((Rectangle){20, 140, 240, 20 }, "button")){
}
}
}
for(auto& c : cm.connections){
if(c.config){
Vec2D<float> config_handle = c.v2->position - ((c.v2->position - c.v1->position))*0.75f;
c.config = !GuiWindowBox((Rectangle){config_handle.x + 10, config_handle.y + 10, 200, 300}, "connection");
GuiToggle((Rectangle){config_handle.x + 10, config_handle.y + 50, 80, 20}, "v1v2", &c.v1_v2);
GuiToggle((Rectangle){config_handle.x + 100, config_handle.y + 50, 80, 20}, "v2v1", &c.v2_v1);
}
}