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. 27
      src/Application/Gui.h

42
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

27
src/Application/Gui.h

@ -2,6 +2,7 @@
#include "ofEvents.h"
#include "GuiEventType.h"
#include "BaseSurface.h"
namespace ofx {
namespace piMapper {
@ -11,6 +12,16 @@ struct GuiEvent {
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 <GuiEvent> event;
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:
static Gui * _instance;
};

Loading…
Cancel
Save