Super simple events added. Seems to be a good way for handling interaction. Modified a few base classes.

This commit is contained in:
Sebastian
2024-11-24 03:08:06 +01:00
parent 62a5c53969
commit f04838bffa
14 changed files with 160 additions and 67 deletions
+30
View File
@@ -56,10 +56,40 @@ namespace VISEQ::APP {
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(){
mutex.lock();
updateMidiPorts();
mutex.unlock();
doInteraction();
mouse.update();
if(KEYS_DOWN.ctrl && IsKeyPressed(KEY_C)){