Browse Source

Move Application mode switching to methods

This gives the possibility to call CommandManager managed calls from the ofxPiMapper class.
master
Krisjanis Rijnieks 9 years ago
parent
commit
8455ac9a17
  1. 40
      src/Application/Application.cpp
  2. 5
      src/Application/Application.h

40
src/Application/Application.cpp

@ -98,27 +98,19 @@ void Application::onKeyPressed(ofKeyEventArgs & args){
break;
case '1':
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, PresentationMode::instance()));
setProjectionMode();
break;
case '2':
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, TextureMappingMode::instance()));
setTextureMode();
break;
case '3':
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, ProjectionMappingMode::instance()));
setProjectionMode();
break;
case '4':
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, SourceSelectionMode::instance()));
setSourceMode();
break;
case 'f':
@ -260,5 +252,29 @@ bool Application::loadXmlSettings(string fileName){
return true;
}
void Application::setPresentationMode(){
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, PresentationMode::instance()));
}
void Application::setTextureMode(){
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, TextureMappingMode::instance()));
}
void Application::setProjectionMode(){
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, ProjectionMappingMode::instance()));
}
void Application::setSourceMode(){
_cmdManager.exec(
new ofx::piMapper::SetApplicationModeCmd(
this, SourceSelectionMode::instance()));
}
} // namespace piMapper
} // namespace ofx

5
src/Application/Application.h

@ -70,6 +70,11 @@ class Application : public KeyListener {
TerminalListener consoleListener;
// Command executors
void setPresentationMode();
void setTextureMode();
void setProjectionMode();
void setSourceMode();
void setActivePreset(unsigned int i);
void setNextPreset();

Loading…
Cancel
Save