Browse Source

Add switch to mode 3 on mouse click

When in presentation mode, switch to projection mapping mode automatically when mouse is clicked.
master
Krisjanis Rijnieks 9 years ago
parent
commit
2ef49511ca
  1. 4
      src/Application/Application.cpp
  2. 1
      src/Application/ApplicationBaseState.h
  3. 7
      src/Application/PresentationState.cpp
  4. 4
      src/Application/PresentationState.h

4
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);

1
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){}

7
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

4
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;

Loading…
Cancel
Save