|
|
@ -16,6 +16,10 @@ namespace ofx { |
|
|
|
ofRemoveListener(ofEvents().keyPressed, this, &Application::onKeyPressed); |
|
|
|
} |
|
|
|
|
|
|
|
ApplicationBaseState * Application::getState() { |
|
|
|
return _state; |
|
|
|
} |
|
|
|
|
|
|
|
void Application::draw(){ |
|
|
|
_state->draw(this); |
|
|
|
} |
|
|
@ -24,36 +28,24 @@ namespace ofx { |
|
|
|
void Application::onKeyPressed(ofKeyEventArgs & args) { |
|
|
|
switch (args.key) { |
|
|
|
case '1': |
|
|
|
ofLogNotice("Application::onKeyPressed()") << "Switching to Presentation State"; |
|
|
|
if (_ofxPiMapper->getGui().getMode() != ofx::piMapper::GuiMode::NONE) { |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetGuiModeCmd(&_ofxPiMapper->getGui(), |
|
|
|
ofx::piMapper::GuiMode::NONE)); |
|
|
|
} |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetApplicationStateCmd( |
|
|
|
this, PresentationState::instance())); |
|
|
|
break; |
|
|
|
case '2': |
|
|
|
ofLogNotice("Application::onKeyPressed()") << "Switching to Projection Mapping State"; |
|
|
|
if (_ofxPiMapper->getGui().getMode() != ofx::piMapper::GuiMode::PROJECTION_MAPPING) { |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetGuiModeCmd(&_ofxPiMapper->getGui(), |
|
|
|
ofx::piMapper::GuiMode::PROJECTION_MAPPING)); |
|
|
|
} |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetApplicationStateCmd( |
|
|
|
this, TextureMappingState::instance())); |
|
|
|
break; |
|
|
|
case '3': |
|
|
|
ofLogNotice("Application::onKeyPressed()") << "Switching to Source Selection State"; |
|
|
|
if (_ofxPiMapper->getGui().getMode() != ofx::piMapper::GuiMode::SOURCE_SELECTION) { |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetGuiModeCmd(&_ofxPiMapper->getGui(), |
|
|
|
ofx::piMapper::GuiMode::SOURCE_SELECTION)); |
|
|
|
} |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetApplicationStateCmd( |
|
|
|
this, ProjectionMappingState::instance())); |
|
|
|
break; |
|
|
|
case '4': |
|
|
|
ofLogNotice("Application::onKeyPressed()") << "Switching to Texture Mapping State"; |
|
|
|
if (_ofxPiMapper->getGui().getMode() != ofx::piMapper::GuiMode::TEXTURE_MAPPING) { |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetGuiModeCmd(&_ofxPiMapper->getGui(), |
|
|
|
ofx::piMapper::GuiMode::TEXTURE_MAPPING)); |
|
|
|
} |
|
|
|
_ofxPiMapper->getCmdManager().exec( |
|
|
|
new ofx::piMapper::SetApplicationStateCmd( |
|
|
|
this, SourceSelectionState::instance())); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|