Browse Source

Add notify joint and surface mouse events

master
Krisjanis Rijnieks 9 years ago
parent
commit
61453d29ea
  1. 42
      src/Application/Gui.cpp
  2. 29
      src/Application/Gui.h

42
src/Application/Gui.cpp

@ -19,5 +19,47 @@ void Gui::notifyEvent(ofMouseEventArgs & args){
ofNotifyEvent(event, e, this); 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 } // piMapper
} // ofx } // ofx

29
src/Application/Gui.h

@ -2,15 +2,26 @@
#include "ofEvents.h" #include "ofEvents.h"
#include "GuiEventType.h" #include "GuiEventType.h"
#include "BaseSurface.h"
namespace ofx { namespace ofx {
namespace piMapper { namespace piMapper {
struct GuiEvent { struct GuiEvent{
ofMouseEventArgs args; ofMouseEventArgs args;
int type; int type;
}; };
struct GuiJointEvent{
ofMouseEventArgs args;
int jointIndex;
};
struct GuiSurfaceEvent{
ofMouseEventArgs args;
BaseSurface * surface;
};
class Gui { class Gui {
public: public:
static Gui * instance(); static Gui * instance();
@ -18,6 +29,22 @@ class Gui {
ofEvent <GuiEvent> event; ofEvent <GuiEvent> event;
void notifyEvent(ofMouseEventArgs & args); void notifyEvent(ofMouseEventArgs & args);
ofEvent <GuiJointEvent> jointPressedEvent;
ofEvent <GuiJointEvent> jointReleasedEvent;
ofEvent <GuiJointEvent> jointDraggedEvent;
void notifyJointPressed(ofMouseEventArgs & args, int jointIndex);
void notifyJointReleased(ofMouseEventArgs & args, int jointIndex);
void notifyJointDragged(ofMouseEventArgs & args, int jointIndex);
ofEvent <GuiSurfaceEvent> surfacePressedEvent;
ofEvent <GuiSurfaceEvent> surfaceReleasedEvent;
ofEvent <GuiSurfaceEvent> surfaceDraggedEvent;
void notifySurfacePressed(ofMouseEventArgs & args, BaseSurface * surface);
void notifySurfaceReleased(ofMouseEventArgs & args, BaseSurface * surface);
void notifySurfaceDragged(ofMouseEventArgs & args, BaseSurface * surface);
private: private:
static Gui * _instance; static Gui * _instance;
}; };

Loading…
Cancel
Save