diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index b43e936..072fbe0 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -41,24 +41,45 @@ namespace ofx { this, PresentationState::instance(), &_ofxPiMapper->getGui(), GuiMode::NONE)); break; + case '2': _ofxPiMapper->getCmdManager().exec( new ofx::piMapper::SetApplicationStateCmd( this, TextureMappingState::instance(), &_ofxPiMapper->getGui(), GuiMode::TEXTURE_MAPPING)); break; + case '3': _ofxPiMapper->getCmdManager().exec( new ofx::piMapper::SetApplicationStateCmd( this, ProjectionMappingState::instance(), &_ofxPiMapper->getGui(), GuiMode::PROJECTION_MAPPING)); break; + case '4': _ofxPiMapper->getCmdManager().exec( new ofx::piMapper::SetApplicationStateCmd( this, SourceSelectionState::instance(), &_ofxPiMapper->getGui(), GuiMode::SOURCE_SELECTION)); break; + + case 'f': + ofToggleFullscreen(); + break; + + case 'i': + _ofxPiMapper->toggleInfo(); + break; + + case 's': + _ofxPiMapper->getSurfaceManager().saveXmlSettings( + PIMAPPER_USER_SURFACES_XML_FILE); + break; + + case 'z': + _ofxPiMapper->getCmdManager().undo(); + break; + default: // All the other keypresses are handled by the application state onKeyPressed _state->onKeyPressed(this, args); diff --git a/src/Application/PresentationState.cpp b/src/Application/PresentationState.cpp index 8f39563..46dbc1d 100644 --- a/src/Application/PresentationState.cpp +++ b/src/Application/PresentationState.cpp @@ -14,7 +14,6 @@ namespace ofx { void PresentationState::draw(Application * app) { ofSetColor(255, 255, 0); - ofDrawBitmapString("Presentation State", 10, 20); } } } \ No newline at end of file diff --git a/src/Application/ProjectionMappingState.cpp b/src/Application/ProjectionMappingState.cpp index e9ca783..dfb1dc0 100644 --- a/src/Application/ProjectionMappingState.cpp +++ b/src/Application/ProjectionMappingState.cpp @@ -12,9 +12,7 @@ namespace ofx { return _instance; } - void ProjectionMappingState::draw(Application * app) { - ofDrawBitmapString("Projection Mapping State", 10, 20); - } + void ProjectionMappingState::draw(Application * app) {} void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & args) { switch (args.key) { diff --git a/src/Application/SourceSelectionState.cpp b/src/Application/SourceSelectionState.cpp index 8277c76..e58580d 100644 --- a/src/Application/SourceSelectionState.cpp +++ b/src/Application/SourceSelectionState.cpp @@ -12,8 +12,6 @@ namespace ofx { return _instance; } - void SourceSelectionState::draw(Application * app) { - ofDrawBitmapString("Source Selection State", 10, 20); - } + void SourceSelectionState::draw(Application * app) {} } } \ No newline at end of file diff --git a/src/Application/TextureMappingState.cpp b/src/Application/TextureMappingState.cpp index 64e0710..a1dc8e8 100644 --- a/src/Application/TextureMappingState.cpp +++ b/src/Application/TextureMappingState.cpp @@ -12,8 +12,6 @@ namespace ofx { return _instance; } - void TextureMappingState::draw(Application * app) { - ofDrawBitmapString("Texture Mapping State", 10, 20); - } + void TextureMappingState::draw(Application * app) {} } } \ No newline at end of file diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index bbc8fdb..1c80339 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -1,11 +1,7 @@ #include "ofxPiMapper.h" ofxPiMapper::ofxPiMapper(): bShowInfo(false), isSetUp(false){ - ofAddListener(ofEvents().keyPressed, this, &ofxPiMapper::keyPressed); -} - -ofxPiMapper::~ofxPiMapper(){ - ofRemoveListener(ofEvents().keyPressed, this, &ofxPiMapper::keyPressed); + } void ofxPiMapper::setup(){ @@ -74,29 +70,6 @@ void ofxPiMapper::draw(){ } // draw -void ofxPiMapper::keyPressed(ofKeyEventArgs &args){ - //ofLogNotice("ofxPiMapper") << "Key pressed: " << static_cast(args.key); - - switch (args.key) { - - case 'i': - bShowInfo = !bShowInfo; - break; - case 'f': - ofToggleFullscreen(); - break; - case 's': - surfaceManager.saveXmlSettings(PIMAPPER_USER_SURFACES_XML_FILE); - break; - case 'z': - // Undo any undo command operation - cmdManager.undo(); - break; - default: - break; - } -} // keyPressed - void ofxPiMapper::addFboSource(ofx::piMapper::FboSource &fboSource){ mediaServer.addFboSource(fboSource); } // addFboSource diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index 9ac9935..0e63e4c 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -27,12 +27,10 @@ class ofxPiMapper{ public: ofxPiMapper(); - ~ofxPiMapper(); void setup(); void stateSetup(); void draw(); - void keyPressed(ofKeyEventArgs& args); void addFboSource(ofx::piMapper::FboSource& fboSource); void addTriangleSurface(); @@ -41,6 +39,7 @@ class ofxPiMapper{ // Toggle help / info void showInfo() { bShowInfo = true; }; void hideInfo() { bShowInfo = false; }; + void toggleInfo() { bShowInfo = !bShowInfo; } // Getters ofx::piMapper::CmdManager & getCmdManager();