Running again after weak_ptr refactoring. No connecting of nodes atm. Copy/Paste might not work, too.

This commit is contained in:
Sebastian
2024-12-04 01:43:06 +01:00
parent 1fde652495
commit 036c6f4723
11 changed files with 150 additions and 104 deletions
+6 -8
View File
@@ -17,12 +17,12 @@ namespace VISEQ::APP::UI{
class AppUI{
public:
AppUI() {}
AppUI(SIGNAL::SignalManager *sm, GraphManager *gm) : gm(gm), sm(sm) {}
AppUI(std::shared_ptr<SIGNAL::SignalManager> sm, std::shared_ptr<GraphManager> gm) : gm(gm), sm(sm) {}
std::shared_ptr<State> state = State::get();
GraphManager *gm;
SIGNAL::SignalManager *sm;
std::shared_ptr<GraphManager> gm;
std::shared_ptr<SIGNAL::SignalManager> sm;
bool bpm_spinner_edit_mode = false;
@@ -60,9 +60,7 @@ namespace VISEQ::APP::UI{
if(GuiButton((Rectangle){20, (float)s_midi + 45 + i*20.0f, 240, 20}, "ENABLE FOR ALL")) {
for(auto &midis : sm->midi.midi_out_ports){
if(midis.enabled){
for(auto n : gm->nodes){
if(n->getNodeType() == NodeType::MIDINODE) std::dynamic_pointer_cast<MidiNode>(n)->setMidiPort(midis.number, true);
}
gm->setMidiPortForAll(midis.number, true);
}
}
}
@@ -96,7 +94,7 @@ namespace VISEQ::APP::UI{
if(GuiButton((Rectangle){20, (float)s_nodes + 60, 240, 20}, "ADD RANDOM NODE")){
gm->addMidiNode(Vec2Df{200.0f, 200.0f});
}
DrawText(std::format("{}", gm->nodes.size()).c_str(), 20, state->settings.height - 70, 15, VS_COLOR_WHITE);
DrawText(std::format("{}", gm->getNodesSize()).c_str(), 20, state->settings.height - 70, 15, VS_COLOR_WHITE);
DrawFPS(20, state->settings.height - 30);
}
@@ -106,7 +104,7 @@ namespace VISEQ::APP::UI{
}
void drawPerNodeConfig(Camera2D camera){
for(auto& n : gm->nodes | std::views::filter([](std::shared_ptr<Node> n){ return n->config; })){
for(auto& n : gm->getSelection() | std::views::filter([](std::shared_ptr<Node> n){ return n->config; })){
Vector2 np = GetWorldToScreen2D((Vector2){n->position.x, n->position.y}, camera);
n->config = !GuiWindowBox((Rectangle){np.x + 10, np.y + 10, 240, 440}, "config");