Super simple events added. Seems to be a good way for handling interaction. Modified a few base classes.
This commit is contained in:
@@ -56,10 +56,40 @@ namespace VISEQ::APP {
|
|||||||
gm.removeNodesAndEdges(nodes);
|
gm.removeNodesAndEdges(nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void doInteraction(){
|
||||||
|
while(event_queue.size() > 0){
|
||||||
|
auto e = event_queue.front();
|
||||||
|
std::cout << e.action << " " << e.item->z_index << std::endl;
|
||||||
|
|
||||||
|
if(e.item->getType() == GraphItemType::NODE || e.item->getType() == GraphItemType::CONNECTOR) {
|
||||||
|
switch(e.action){
|
||||||
|
case VISEQ::APP::Interaction::PICKUP:
|
||||||
|
{
|
||||||
|
e.item->pickUp();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VISEQ::APP::Interaction::DRAG:
|
||||||
|
{
|
||||||
|
e.item->drag();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VISEQ::APP::Interaction::PUTDOWN:
|
||||||
|
{
|
||||||
|
e.item->putDown();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
event_queue.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void update(){
|
void update(){
|
||||||
mutex.lock();
|
mutex.lock();
|
||||||
updateMidiPorts();
|
updateMidiPorts();
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
|
doInteraction();
|
||||||
mouse.update();
|
mouse.update();
|
||||||
|
|
||||||
if(KEYS_DOWN.ctrl && IsKeyPressed(KEY_C)){
|
if(KEYS_DOWN.ctrl && IsKeyPressed(KEY_C)){
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
#include "datatypes.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "draggable.h"
|
#include "draggable.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
@@ -33,6 +34,10 @@ namespace VISEQ::APP::CANVAS {
|
|||||||
EndMode2D();
|
EndMode2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GRAPH::GraphItemType getType() override {
|
||||||
|
return GRAPH::GraphItemType::CANVAS;
|
||||||
|
}
|
||||||
|
|
||||||
void makeSelection(){
|
void makeSelection(){
|
||||||
if(MOUSE_LEFT.clicked){
|
if(MOUSE_LEFT.clicked){
|
||||||
state->selection = (Rectangle){0,0,0,0};
|
state->selection = (Rectangle){0,0,0,0};
|
||||||
|
|||||||
@@ -23,15 +23,6 @@ namespace VISEQ::BASE {
|
|||||||
DrawLineV(position, MOD_MOUSE, (Color){229, 181, 103, 255});
|
DrawLineV(position, MOD_MOUSE, (Color){229, 181, 103, 255});
|
||||||
}
|
}
|
||||||
|
|
||||||
void update() override{
|
|
||||||
if(STATE != IState::DRAG_NODE){
|
|
||||||
Draggable::update();
|
|
||||||
if(pickedUp()) drag();
|
|
||||||
if(released()) putDown();
|
|
||||||
// is_hovering = hovering();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void putDown() override {
|
void putDown() override {
|
||||||
connect();
|
connect();
|
||||||
Draggable::putDown();
|
Draggable::putDown();
|
||||||
|
|||||||
+15
-3
@@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "connectable.h"
|
#include "connectable.h"
|
||||||
|
#include "datatypes.h"
|
||||||
#include "graph-item.h"
|
#include "graph-item.h"
|
||||||
|
#include "moveable.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "vmath.h"
|
#include "vmath.h"
|
||||||
@@ -9,7 +11,7 @@
|
|||||||
namespace VISEQ::GRAPH {
|
namespace VISEQ::GRAPH {
|
||||||
class Connector : public BASE::Connectable, public GraphItem{
|
class Connector : public BASE::Connectable, public GraphItem{
|
||||||
public:
|
public:
|
||||||
using GraphItem::state;
|
using BASE::Movable::state;
|
||||||
|
|
||||||
Connector() {}
|
Connector() {}
|
||||||
Connector(std::shared_ptr<GraphItem> parent, Vec2Df center_position, float orbit) : orbit(orbit) {
|
Connector(std::shared_ptr<GraphItem> parent, Vec2Df center_position, float orbit) : orbit(orbit) {
|
||||||
@@ -17,6 +19,10 @@ namespace VISEQ::GRAPH {
|
|||||||
setParent(parent);
|
setParent(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GraphItemType getType() override{
|
||||||
|
return GraphItemType::CONNECTOR;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<GraphItem> parent;
|
std::shared_ptr<GraphItem> parent;
|
||||||
|
|
||||||
bool hover_connect = false;
|
bool hover_connect = false;
|
||||||
@@ -25,8 +31,12 @@ namespace VISEQ::GRAPH {
|
|||||||
float orbit = 14.0f;
|
float orbit = 14.0f;
|
||||||
Vec2Df center_position;
|
Vec2Df center_position;
|
||||||
|
|
||||||
|
std::shared_ptr<Connectable> getPtr(){
|
||||||
|
return std::static_pointer_cast<Connector>(shared_from_this());
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool hovering() override {
|
virtual bool hovering() override {
|
||||||
return STATE != IState::DRAW_SELECTION && CheckCollisionPointCircle(SCREEN_MOUSE, position, radius);
|
return CheckCollisionPointCircle(SCREEN_MOUSE, position, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setParent(std::shared_ptr<GraphItem> _parent){
|
void setParent(std::shared_ptr<GraphItem> _parent){
|
||||||
@@ -40,7 +50,9 @@ namespace VISEQ::GRAPH {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update() override {
|
void update() override {
|
||||||
BASE::Connectable::update();
|
if(hovering() && clicked()) state->pushEvent({getPtr(), APP::Interaction::PICKUP});
|
||||||
|
if(pickedUp()) state->pushEvent({getPtr(), APP::Interaction::DRAG});
|
||||||
|
if(picked_up && released()) state->pushEvent({getPtr(), APP::Interaction::PUTDOWN});
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw() override {
|
void draw() override {
|
||||||
|
|||||||
+1
-1
@@ -33,7 +33,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
|
|
||||||
|
|
||||||
namespace VISEQ::GRAPH{
|
namespace VISEQ::GRAPH{
|
||||||
enum GraphItemType {NODE, EDGE};
|
enum GraphItemType {NODE, EDGE, CONNECTOR, CANVAS};
|
||||||
enum NodeType {OSCNODE, MIDINODE, CONFIGNODE};
|
enum NodeType {OSCNODE, MIDINODE, CONFIGNODE};
|
||||||
enum EdgeType {MIDIEDGE, CONFIGEDGE};
|
enum EdgeType {MIDIEDGE, CONFIGEDGE};
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-34
@@ -14,6 +14,8 @@ namespace VISEQ::BASE {
|
|||||||
Draggable(Vec2Df p) : Movable(p, 960.0f) {}
|
Draggable(Vec2Df p) : Movable(p, 960.0f) {}
|
||||||
virtual ~Draggable() {}
|
virtual ~Draggable() {}
|
||||||
|
|
||||||
|
std::shared_ptr<APP::State> state = APP::State::get();
|
||||||
|
|
||||||
Vec2Df drag_offset;
|
Vec2Df drag_offset;
|
||||||
|
|
||||||
bool picked_up = false;
|
bool picked_up = false;
|
||||||
@@ -27,14 +29,15 @@ namespace VISEQ::BASE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool pickedUp() {
|
virtual bool pickedUp() {
|
||||||
if(clicked() && held() && (STATE == IState::HOVER_NODE || STATE == IState::DRAG_NODE)) {
|
return held() && picked_up;
|
||||||
picked_up = true;
|
|
||||||
drag_offset = position - SCREEN_MOUSE;
|
|
||||||
}
|
|
||||||
return picked_up;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void drag() {
|
virtual void pickUp() override {
|
||||||
|
picked_up = true;
|
||||||
|
drag_offset = position - SCREEN_MOUSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void drag() override {
|
||||||
if(KEYS_PRESSED.ctrl){
|
if(KEYS_PRESSED.ctrl){
|
||||||
selection_offset = position - state->hover_position;
|
selection_offset = position - state->hover_position;
|
||||||
}
|
}
|
||||||
@@ -45,7 +48,7 @@ namespace VISEQ::BASE {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void putDown(){
|
virtual void putDown() override {
|
||||||
picked_up = false;
|
picked_up = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,32 +57,5 @@ namespace VISEQ::BASE {
|
|||||||
if(MOUSE_LEFT.released) selected = (KEYS_DOWN.shift && selected) || in_selection_rect;
|
if(MOUSE_LEFT.released) selected = (KEYS_DOWN.shift && selected) || in_selection_rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void update() override {
|
|
||||||
if(STATE != IState::HOVER_NODE) select();
|
|
||||||
if((pickedUp() || hovering()) && z_hovering == -1) z_hovering = z_index;
|
|
||||||
|
|
||||||
if(z_index == z_hovering || selected){
|
|
||||||
if(pickedUp()){
|
|
||||||
drag();
|
|
||||||
STATE = IState::DRAG_NODE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(STATE != IState::DRAG_NODE){
|
|
||||||
if(entered()){
|
|
||||||
STATE = IState::HOVER_NODE;
|
|
||||||
std::cout << "z_index=" << z_index << " z_hovering=" << z_hovering << std::endl;
|
|
||||||
is_hovering = true;
|
|
||||||
}
|
|
||||||
if(exited()){
|
|
||||||
STATE = IState::HOVER_CANVAS;
|
|
||||||
is_hovering = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(released() && picked_up){
|
|
||||||
putDown();
|
|
||||||
STATE = IState::HOVER_CANVAS;
|
|
||||||
if(hovering()) STATE = IState::HOVER_NODE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "state.h"
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
|
#include "vmath.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace VISEQ::GRAPH {
|
namespace VISEQ::GRAPH {
|
||||||
@@ -12,11 +12,11 @@ namespace VISEQ::GRAPH {
|
|||||||
GraphItem() {newId(-1);}
|
GraphItem() {newId(-1);}
|
||||||
GraphItem(const GraphItem& G) {
|
GraphItem(const GraphItem& G) {
|
||||||
newId(-1);
|
newId(-1);
|
||||||
graphItemType = G.graphItemType;
|
gItemType = G.gItemType;
|
||||||
}
|
}
|
||||||
GraphItemType graphItemType;
|
|
||||||
|
|
||||||
std::shared_ptr<APP::State> state = APP::State::get();
|
GraphItemType gItemType;
|
||||||
|
|
||||||
|
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ namespace VISEQ::GRAPH {
|
|||||||
|
|
||||||
virtual void draw() {};
|
virtual void draw() {};
|
||||||
virtual void draw(Vec2Df mouse, Camera2D cam) {};
|
virtual void draw(Vec2Df mouse, Camera2D cam) {};
|
||||||
virtual GraphItemType getType() {return graphItemType;}
|
virtual GraphItemType getType() {return gItemType;}
|
||||||
virtual ~GraphItem() = default;
|
virtual ~GraphItem() = default;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "datatypes.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
namespace VISEQ::BASE {
|
namespace VISEQ::BASE {
|
||||||
|
|
||||||
@@ -33,6 +34,10 @@ namespace VISEQ::BASE {
|
|||||||
virtual bool released() {
|
virtual bool released() {
|
||||||
return IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
return IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
|
||||||
}
|
}
|
||||||
|
virtual GRAPH::GraphItemType getType() = 0;
|
||||||
|
virtual void pickUp() = 0;
|
||||||
|
virtual void drag() = 0;
|
||||||
|
virtual void putDown() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "interactable.h"
|
||||||
|
#include <memory>
|
||||||
|
#include <queue>
|
||||||
|
namespace VISEQ::APP{
|
||||||
|
|
||||||
|
enum Interaction {HOVER, CLICK, HOLD, RELEASE, PICKUP, DRAG, PUTDOWN};
|
||||||
|
|
||||||
|
struct InteractionEvent{
|
||||||
|
std::shared_ptr<BASE::Interactable> item;
|
||||||
|
Interaction action;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline static std::queue<VISEQ::APP::InteractionEvent> event_queue;
|
||||||
|
}
|
||||||
+2
-4
@@ -1,7 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "graph-item.h"
|
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -13,7 +12,6 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
class MidiNode : public Node{
|
class MidiNode : public Node{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using GraphItem::state;
|
|
||||||
|
|
||||||
struct NodeMidiOut{
|
struct NodeMidiOut{
|
||||||
int i;
|
int i;
|
||||||
@@ -89,7 +87,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
float wheel = GetMouseWheelMove();
|
float wheel = GetMouseWheelMove();
|
||||||
|
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.alt){
|
if(KEYS_DOWN.ctrl && !KEYS_DOWN.alt){
|
||||||
switch(GraphItem::state->node_mode){
|
switch(state->node_mode){
|
||||||
case 0:{
|
case 0:{
|
||||||
midi_note += wheel;
|
midi_note += wheel;
|
||||||
break;}
|
break;}
|
||||||
@@ -114,7 +112,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
if(midi_velocity < 0 ) midi_velocity = 127;
|
if(midi_velocity < 0 ) midi_velocity = 127;
|
||||||
if(midi_velocity > 127 ) midi_velocity = 0;
|
if(midi_velocity > 127 ) midi_velocity = 0;
|
||||||
} else if(KEYS_DOWN.alt) {
|
} else if(KEYS_DOWN.alt) {
|
||||||
switch(GraphItem::state->node_mode){
|
switch(state->node_mode){
|
||||||
case 0:{
|
case 0:{
|
||||||
float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f);
|
float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f);
|
||||||
midi_gate += incr;
|
midi_gate += incr;
|
||||||
|
|||||||
+47
-4
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "draggable.h"
|
#include "draggable.h"
|
||||||
#include "graph-manager.h"
|
#include "graph-manager.h"
|
||||||
|
#include "interaction-event.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
namespace VISEQ::APP {
|
namespace VISEQ::APP {
|
||||||
class Mouse {
|
class Mouse {
|
||||||
@@ -12,11 +13,53 @@ namespace VISEQ::APP {
|
|||||||
GraphManager *gm;
|
GraphManager *gm;
|
||||||
|
|
||||||
void update(){
|
void update(){
|
||||||
auto hovering_nodes = gm->nodes | RANGE_FILTER([](SPTR_Node n) { return n->is_hovering;}) | std::ranges::to<std::vector<std::shared_ptr<BASE::Draggable>>>();
|
auto hovering_nodes = gm->nodes | RANGE_FILTER([](SPTR_Node n) { return n->hovering() || n->picked_up;}) | std::ranges::to<std::vector<std::shared_ptr<BASE::Draggable>>>();
|
||||||
|
|
||||||
|
/*if(!hovering_nodes.empty()){*/
|
||||||
|
/* hovering_nodes.front()->is_hovering = true;*/
|
||||||
|
/**/
|
||||||
|
/* if(hovering_nodes.front()->pickedUp()) hovering_nodes.front()->drag();*/
|
||||||
|
/* if(hovering_nodes.front()->released()) hovering_nodes.front()->putDown();*/
|
||||||
|
/**/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
if(!hovering_nodes.empty()){
|
|
||||||
//hovering_nodes.front()->is_hovering = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void interact(InteractionEvent e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*virtual void select() override {*/
|
||||||
|
/* if(STATE == IState::DRAW_SELECTION) in_selection_rect = CheckCollisionPointRec(position, state->selection);*/
|
||||||
|
/* if(MOUSE_LEFT.released) selected = (KEYS_DOWN.shift && selected) || in_selection_rect;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*virtual void update() override {*/
|
||||||
|
/* if(STATE != IState::HOVER_NODE) select();*/
|
||||||
|
/* if((pickedUp() || hovering()) && z_hovering == -1) z_hovering = z_index;*/
|
||||||
|
/**/
|
||||||
|
/* if(z_index == z_hovering || selected){*/
|
||||||
|
/* if(pickedUp()){*/
|
||||||
|
/* drag();*/
|
||||||
|
/* STATE = IState::DRAG_NODE;*/
|
||||||
|
/* }*/
|
||||||
|
/* }*/
|
||||||
|
/* if(STATE != IState::DRAG_NODE){*/
|
||||||
|
/* if(entered()){*/
|
||||||
|
/* STATE = IState::HOVER_NODE;*/
|
||||||
|
/* std::cout << "z_index=" << z_index << " z_hovering=" << z_hovering << std::endl;*/
|
||||||
|
/* is_hovering = true;*/
|
||||||
|
/* }*/
|
||||||
|
/* if(exited()){*/
|
||||||
|
/* STATE = IState::HOVER_CANVAS;*/
|
||||||
|
/* is_hovering = false;*/
|
||||||
|
/* }*/
|
||||||
|
/* }*/
|
||||||
|
/* if(released() && picked_up){*/
|
||||||
|
/* putDown();*/
|
||||||
|
/* STATE = IState::HOVER_CANVAS;*/
|
||||||
|
/* if(hovering()) STATE = IState::HOVER_NODE;*/
|
||||||
|
/* }*/
|
||||||
|
/*}*/
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+15
-5
@@ -8,6 +8,7 @@
|
|||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "draggable.h"
|
#include "draggable.h"
|
||||||
#include "graph-item.h"
|
#include "graph-item.h"
|
||||||
|
#include "interaction-event.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "vmath.h"
|
#include "vmath.h"
|
||||||
|
|
||||||
@@ -17,10 +18,9 @@ namespace VISEQ::GRAPH::EDGES{
|
|||||||
|
|
||||||
namespace VISEQ::GRAPH::NODES {
|
namespace VISEQ::GRAPH::NODES {
|
||||||
|
|
||||||
class Node : public BASE::Draggable, public GraphItem{
|
class Node : public BASE::Draggable, public GraphItem {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using GraphItem::state;
|
|
||||||
|
|
||||||
Node() {}
|
Node() {}
|
||||||
Node(float x, float y) : Draggable(Vec2Df(x, y)) {}
|
Node(float x, float y) : Draggable(Vec2Df(x, y)) {}
|
||||||
@@ -41,7 +41,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
bool config = false;
|
bool config = false;
|
||||||
|
|
||||||
virtual bool hovering() override {
|
virtual bool hovering() override {
|
||||||
return STATE != IState::DRAW_SELECTION && CheckCollisionPointCircle(SCREEN_MOUSE, position, radius);
|
return CheckCollisionPointCircle(SCREEN_MOUSE, position, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addConnector() {
|
void addConnector() {
|
||||||
@@ -59,8 +59,19 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
|
|
||||||
virtual void trigger() {};
|
virtual void trigger() {};
|
||||||
|
|
||||||
|
GraphItemType getType() override{
|
||||||
|
return GraphItemType::NODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Node> getPtr(){
|
||||||
|
return std::static_pointer_cast<Node>(shared_from_this());
|
||||||
|
}
|
||||||
|
|
||||||
void update() override{
|
void update() override{
|
||||||
BASE::Draggable::update();
|
|
||||||
|
if(hovering() && clicked()) state->pushEvent({getPtr(), APP::Interaction::PICKUP});
|
||||||
|
if(pickedUp()) state->pushEvent({getPtr(), APP::Interaction::DRAG});
|
||||||
|
if(picked_up && released()) state->pushEvent({getPtr(), APP::Interaction::PUTDOWN});
|
||||||
|
|
||||||
int free_connectors = 0;
|
int free_connectors = 0;
|
||||||
for(auto c : connectors){
|
for(auto c : connectors){
|
||||||
@@ -69,7 +80,6 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
c->update();
|
c->update();
|
||||||
}
|
}
|
||||||
if(free_connectors == 0) addConnector();
|
if(free_connectors == 0) addConnector();
|
||||||
/*is_hovering = hovering();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(Vec2Df mp, Camera2D cam) override {}
|
void draw(Vec2Df mp, Camera2D cam) override {}
|
||||||
|
|||||||
+1
-1
@@ -136,7 +136,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
namespace VISEQ::GRAPH {
|
namespace VISEQ::GRAPH {
|
||||||
inline void to_json(json& j, const GraphItem& G){
|
inline void to_json(json& j, const GraphItem& G){
|
||||||
std::cout << "Movable" << std::endl;
|
std::cout << "Movable" << std::endl;
|
||||||
j = json{{"id", G.id}, {"type", G.graphItemType}};
|
j = json{{"id", G.id}, {"type", G.gItemType}};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void to_json(json& j, const SPTR_GraphItem& G){
|
inline void to_json(json& j, const SPTR_GraphItem& G){
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "interaction-event.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "vmath.h"
|
#include "vmath.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <queue>
|
||||||
|
|
||||||
#define STATE state->istate
|
#define STATE state->istate
|
||||||
#define SETTINGS state->settings
|
#define SETTINGS state->settings
|
||||||
@@ -78,7 +80,12 @@ namespace VISEQ::APP{
|
|||||||
|
|
||||||
Vec2Df hover_position;
|
Vec2Df hover_position;
|
||||||
|
|
||||||
|
void pushEvent(InteractionEvent e){
|
||||||
|
event_queue.push(e);
|
||||||
|
}
|
||||||
|
|
||||||
void update(Camera2D camera){
|
void update(Camera2D camera){
|
||||||
|
|
||||||
if(istate != old_istate) std::cout << state_string[istate] << std::endl;
|
if(istate != old_istate) std::cout << state_string[istate] << std::endl;
|
||||||
|
|
||||||
mouse_delta = {GetMouseDelta().x, GetMouseDelta().y};
|
mouse_delta = {GetMouseDelta().x, GetMouseDelta().y};
|
||||||
|
|||||||
Reference in New Issue
Block a user