diff --git a/src/graph-item.h b/src/graph-item.h index fd4768d..ea0d3c3 100644 --- a/src/graph-item.h +++ b/src/graph-item.h @@ -9,9 +9,9 @@ namespace VISEQ::GRAPH { class GraphItem{ public: - GraphItem() {newId();} + GraphItem() {newId(-1);} GraphItem(const GraphItem& G) { - newId(); + newId(-1); graphItemType = G.graphItemType; neighbors = G.neighbors; } @@ -20,8 +20,9 @@ namespace VISEQ::GRAPH { int id = 0; - void newId(){ + void newId(int start){ static int _id; + if(start > -1) _id = start; id = _id; _id++; } diff --git a/src/main.cpp b/src/main.cpp index 1c1a13c..ef56ffd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,6 +9,7 @@ #include "graph-manager.h" #include "node.h" #include "vmath.h" +#include #include #include #define RAYGUI_IMPLEMENTATION @@ -29,8 +30,6 @@ #include #include -#include "state-io.h" - using json = nlohmann::json; VISEQ::APP::AppState app; @@ -85,16 +84,25 @@ int main(){ app.settings = graph.at("settings"); -// app.gm = graph["graphmanager"].get(); int highest_id = 0; std::shared_ptr hid; for(auto n : graph.at("graphmanager").at("nodes")){ std::shared_ptr mn = n; - app.gm.nodes.push_back(mn); if(mn->id > highest_id) { highest_id = mn->id; hid = mn; } + } + + for(auto e : graph.at("graphmanager").at("edges")){ + if(e.at("id") > highest_id){ + highest_id = e.at("id"); + } + } + + for(auto n : graph.at("graphmanager").at("nodes")){ + std::shared_ptr mn = n; + app.gm.nodes.push_back(mn); std::cout << std::format("adding node {}", mn->id) << std::endl; } @@ -111,7 +119,9 @@ int main(){ } } - + + app.gm.edges.back()->newId(highest_id); // reset static id counter in base class + for(auto s : graph.at("signalmanager").at("signals")){ int start_id = s.at("start").get(); int next_id = s.at("next").get(); diff --git a/src/ui.h b/src/ui.h index aed7cb1..b3549c3 100644 --- a/src/ui.h +++ b/src/ui.h @@ -94,6 +94,17 @@ namespace VISEQ::APP::UI{ } DrawText(std::format("{}", gm->nodes.size()).c_str(), 20, settings->height - 70, 15, VS_COLOR_WHITE); DrawFPS(20, settings->height - 30); + } + + void drawPropertiesBar(){ + + float left = settings->width - 280.f; + + GuiPanel((Rectangle){left,-30,280,(float)settings->height + 31}, ""); + const int s_controls = 25; + + + } void drawPerNodeConfig(Camera2D *camera){ @@ -188,6 +199,7 @@ namespace VISEQ::APP::UI{ void draw(Vec2Df *mouse_pos, Camera2D *camera){ drawSideBar(); + drawPropertiesBar(); drawPerNodeConfig(camera); }