65 lines
1.3 KiB
C++
65 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <raylib.h>
|
|
|
|
#include "connector.h"
|
|
#include "datatypes.h"
|
|
#include "draggable.h"
|
|
#include "graph-item.h"
|
|
#include "vmath.h"
|
|
|
|
namespace VISEQ::GRAPH::EDGES{
|
|
class Edge;
|
|
}
|
|
|
|
namespace VISEQ::GRAPH::NODES {
|
|
|
|
class Node : public BASE::Draggable, public GraphItem{
|
|
|
|
public:
|
|
Node() {}
|
|
Node(float x, float y) : Draggable(Vec2Df(x, y)) {}
|
|
Node(Vec2Df p) : Draggable(p) {}
|
|
|
|
NodeType nodeType;
|
|
|
|
std::vector<std::shared_ptr<Node>> neighbors;
|
|
std::vector<std::shared_ptr<VISEQ::GRAPH::EDGES::Edge>> connections;
|
|
|
|
std::vector<std::shared_ptr<Connector>> connectors;
|
|
|
|
Distribution distributionMode = Distribution::GEOMETRIC;
|
|
|
|
float radius = 15.0f;
|
|
bool config = false;
|
|
|
|
|
|
virtual NodeType getNodeType() const {return nodeType;}
|
|
|
|
virtual void SMode(int mode) {};
|
|
virtual int GGate() {return 0;};
|
|
virtual int GActive() {return 0;};
|
|
virtual void trigger() {};
|
|
|
|
virtual bool hovering() override {
|
|
Vec2Df mp = {GetMousePosition().x, GetMousePosition().y};
|
|
return CheckCollisionPointCircle(mp, position, radius);
|
|
}
|
|
|
|
void update() override{
|
|
if(pickedUp()) drag();
|
|
if(released()) putDown();
|
|
for(auto c : connectors){
|
|
c->updatePosition(position);
|
|
c->update();
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
typedef std::shared_ptr<VISEQ::GRAPH::NODES::Node> SPTR_Node;
|
|
typedef std::vector<SPTR_Node> VEC_SPTR_Node;
|
|
|
|
}
|