diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 1b0cf02..0cb0ab4 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -114,7 +114,9 @@ void Application::onKeyReleased(ofKeyEventArgs & args){ } } -void Application::onMousePressed(ofMouseEventArgs & args){} +void Application::onMousePressed(ofMouseEventArgs & args){ + _state->onMousePressed(this, args); +} void Application::onJointPressed(GuiJointEvent & e){ _state->onJointPressed(this, e); diff --git a/src/Application/ApplicationBaseState.h b/src/Application/ApplicationBaseState.h index 4edbeaf..6a7787d 100644 --- a/src/Application/ApplicationBaseState.h +++ b/src/Application/ApplicationBaseState.h @@ -17,6 +17,7 @@ class ApplicationBaseState { // Event handler virtual methods virtual void onKeyPressed(Application * app, ofKeyEventArgs & args){} + virtual void onMousePressed(Application * app, ofMouseEventArgs & args){} virtual void onJointPressed(Application * app, GuiJointEvent & e){} virtual void onSurfacePressed(Application * app, GuiSurfaceEvent & e){} virtual void onBackgroundPressed(Application * app, GuiBackgroundEvent & e){} diff --git a/src/Application/PresentationState.cpp b/src/Application/PresentationState.cpp index 6f5f7e1..e4f60db 100644 --- a/src/Application/PresentationState.cpp +++ b/src/Application/PresentationState.cpp @@ -16,5 +16,12 @@ void PresentationState::draw(Application * app){ app->getGui()->draw(); } +void PresentationState::onMousePressed(Application * app, ofMouseEventArgs & args){ + app->getCmdManager()->exec( + new ofx::piMapper::SetApplicationStateCmd( + app, ProjectionMappingState::instance(), + app->getGui(), GuiMode::PROJECTION_MAPPING)); +} + } // namespace piMapper } // namespace ofx \ No newline at end of file diff --git a/src/Application/PresentationState.h b/src/Application/PresentationState.h index 22f10de..c30e706 100644 --- a/src/Application/PresentationState.h +++ b/src/Application/PresentationState.h @@ -4,6 +4,9 @@ #include "ofEvents.h" #include "ofLog.h" #include "ofGraphics.h" +#include "SetApplicationStateCmd.h" +#include "ProjectionMappingState.h" +#include "GuiMode.h" namespace ofx { namespace piMapper { @@ -13,6 +16,7 @@ class PresentationState : public ApplicationBaseState { public: static PresentationState * instance(); void draw(Application * app); + void onMousePressed(Application * app, ofMouseEventArgs & args); private: static PresentationState * _instance;