Connectables working now. On to more refactoring!

This commit is contained in:
Sebastian
2024-11-13 14:39:46 +01:00
parent 1e0a131169
commit e6f370ba4f
5 changed files with 22 additions and 10 deletions
+1 -5
View File
@@ -1,6 +1,5 @@
#pragma once
#include "datatypes.h"
#include "draggable.h"
#include <memory>
@@ -8,9 +7,7 @@ namespace VISEQ::BASE {
class Connectable : public Draggable{
public:
Connectable() {}
/*Connectable() {VISEQ::BASE::Connectable::connectables.emplace_back(this);}*/
Connectable(Vec2Df position) : Draggable(position) {}
/*virtual ~Connectable() { connectables.erase(std::remove(connectables.begin(), connectables.end(), std::shared_ptr<Connectable>(this)), connectables.end()); }*/
virtual ~Connectable() {}
inline static std::vector<std::shared_ptr<Connectable>> connectables;
@@ -23,7 +20,6 @@ namespace VISEQ::BASE {
virtual bool hovering() override {
Vec2Df mp = {GetMousePosition().x, GetMousePosition().y};
std::cout << "hovering" << std::endl;
return CheckCollisionPointCircle(mp, position, 5);
}
@@ -42,7 +38,6 @@ namespace VISEQ::BASE {
Draggable::putDown();
}
virtual void connect() {
Vec2Df mp = {GetMousePosition().x, GetMousePosition().y};
@@ -50,6 +45,7 @@ namespace VISEQ::BASE {
for(auto c : connectables){
if(c.get() != this && c->hovering()) {
partner = c;
c->partner.reset(this);
break;
}
}