dragging works. introducing connectors maybe
This commit is contained in:
+23
-4
@@ -3,9 +3,11 @@
|
||||
#include <memory>
|
||||
#include <raylib.h>
|
||||
|
||||
#include "connector.h"
|
||||
#include "datatypes.h"
|
||||
#include "draggable.h"
|
||||
#include "graph-item.h"
|
||||
#include "moveable.h"
|
||||
#include "vmath.h"
|
||||
|
||||
namespace VISEQ::GRAPH::EDGES{
|
||||
class Edge;
|
||||
@@ -13,29 +15,46 @@ namespace VISEQ::GRAPH::EDGES{
|
||||
|
||||
namespace VISEQ::GRAPH::NODES {
|
||||
|
||||
class Node : public BASE::Movable, public GraphItem{
|
||||
class Node : public BASE::Draggable, public GraphItem{
|
||||
|
||||
public:
|
||||
Node() {}
|
||||
Node(float x, float y) : Movable(Vec2Df(x, y), 960.0f) {}
|
||||
Node(Vec2Df p) : Movable(p, 960.0f) {}
|
||||
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->update(position);
|
||||
}
|
||||
}
|
||||
|
||||
void draw(Vec2Df mouse_pos, Camera2D cam) override {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user