Running again. Next step: making connections work again!

This commit is contained in:
Sebastian
2024-12-05 00:01:42 +01:00
parent 036c6f4723
commit b6c2029386
8 changed files with 56 additions and 58 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ namespace VISEQ::GRAPH::EDGES{
namespace VISEQ::GRAPH::NODES {
class Node : public BASE::Draggable, public GraphItem {
class Node : public BASE::Draggable, public GraphItem, public std::enable_shared_from_this<Node> {
public:
@@ -36,13 +36,17 @@ namespace VISEQ::GRAPH::NODES {
float radius = 15.0f;
bool config = false;
std::shared_ptr<Node> getPtr(){
return shared_from_this();
}
virtual bool hovering() override {
return CheckCollisionPointCircle(SCREEN_MOUSE, position, radius);
}
void addConnector() {
connectors.emplace_back(std::make_shared<Connector>(GraphItem::getptr(), position, radius + 5.0f));
connectors.emplace_back(std::make_shared<Connector>(getPtr(), position, radius + 5.0f));
}
void removeConnector(std::weak_ptr<Connector> connector){
@@ -63,10 +67,6 @@ namespace VISEQ::GRAPH::NODES {
return GraphItemType::NODE;
}
std::shared_ptr<Node> getPtr(){
return std::static_pointer_cast<Node>(shared_from_this());
}
void update() override{
if(hovering()) state->pushEvent({getPtr(), APP::Interaction::HOVER});
if(hovering() && clicked()) state->pushEvent({getPtr(), APP::Interaction::PICKUP});