diff --git a/src/Application/Gui.cpp b/src/Application/Gui.cpp index c60f40f..5afea42 100644 --- a/src/Application/Gui.cpp +++ b/src/Application/Gui.cpp @@ -19,5 +19,47 @@ void Gui::notifyEvent(ofMouseEventArgs & args){ ofNotifyEvent(event, e, this); } +void Gui::notifyJointPressed(ofMouseEventArgs & args, int jointIndex){ + GuiJointEvent e; + e.args = args; + e.jointIndex = jointIndex; + ofNotifyEvent(jointPressedEvent, e, this); +} + +void Gui::notifyJointReleased(ofMouseEventArgs & args, int jointIndex){ + GuiJointEvent e; + e.args = args; + e.jointIndex = jointIndex; + ofNotifyEvent(jointReleasedEvent, e, this); +} + +void Gui::notifyJointDragged(ofMouseEventArgs & args, int jointIndex){ + GuiJointEvent e; + e.args = args; + e.jointIndex = jointIndex; + ofNotifyEvent(jointDraggedEvent, e, this); +} + +void Gui::notifySurfacePressed(ofMouseEventArgs & args, BaseSurface * surface){ + GuiSurfaceEvent e; + e.args = args; + e.surface = surface; + ofNotifyEvent(surfacePressedEvent, e, this); +} + +void Gui::notifySurfaceReleased(ofMouseEventArgs & args, BaseSurface * surface){ + GuiSurfaceEvent e; + e.args = args; + e.surface = surface; + ofNotifyEvent(surfaceReleasedEvent, e, this); +} + +void Gui::notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface){ + GuiSurfaceEvent e; + e.args = args; + e.surface = surface; + ofNotifyEvent(surfaceDraggedEvent, e, this); +} + } // piMapper } // ofx \ No newline at end of file diff --git a/src/Application/Gui.h b/src/Application/Gui.h index ecc6278..1c611a5 100644 --- a/src/Application/Gui.h +++ b/src/Application/Gui.h @@ -2,15 +2,26 @@ #include "ofEvents.h" #include "GuiEventType.h" +#include "BaseSurface.h" namespace ofx { namespace piMapper { -struct GuiEvent { +struct GuiEvent{ ofMouseEventArgs args; int type; }; +struct GuiJointEvent{ + ofMouseEventArgs args; + int jointIndex; +}; + +struct GuiSurfaceEvent{ + ofMouseEventArgs args; + BaseSurface * surface; +}; + class Gui { public: static Gui * instance(); @@ -18,6 +29,22 @@ class Gui { ofEvent event; void notifyEvent(ofMouseEventArgs & args); + ofEvent jointPressedEvent; + ofEvent jointReleasedEvent; + ofEvent jointDraggedEvent; + + void notifyJointPressed(ofMouseEventArgs & args, int jointIndex); + void notifyJointReleased(ofMouseEventArgs & args, int jointIndex); + void notifyJointDragged(ofMouseEventArgs & args, int jointIndex); + + ofEvent surfacePressedEvent; + ofEvent surfaceReleasedEvent; + ofEvent surfaceDraggedEvent; + + void notifySurfacePressed(ofMouseEventArgs & args, BaseSurface * surface); + void notifySurfaceReleased(ofMouseEventArgs & args, BaseSurface * surface); + void notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface); + private: static Gui * _instance; };