json serialization beginnings, but still much to do

This commit is contained in:
Sebastian
2024-11-02 15:52:16 +01:00
parent 70d0a186a4
commit 522e9d456a
17 changed files with 25274 additions and 224 deletions
+10 -2
View File
@@ -8,11 +8,19 @@
class GraphItem{
public:
GraphItem() {static int _id; id=_id++;}
std::vector<std::shared_ptr<GraphItem>> neighbors;
int id = 0;
GraphItemType graphItemType;
virtual void draw(Vec2D<float> mouse, Camera2D cam) = 0;
virtual void draw(Vec2Df mouse, Camera2D cam) {};
virtual GraphItemType getType() {return graphItemType;}
virtual ~GraphItem() = default;
/*void to_json(json& j, const GraphItem& G){*/
/* j = json{{"id",id},{"graphItemType",graphItemType},{"neighbors",neighbors}};*/
/*}*/
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(GraphItem, id, graphItemType, neighbors)