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; break;
case '1': case '1':
_cmdManager.exec( setProjectionMode();
new ofx::piMapper::SetApplicationModeCmd(
this, PresentationMode::instance()));
break; break;
case '2': case '2':
_cmdManager.exec( setTextureMode();
new ofx::piMapper::SetApplicationModeCmd(
this, TextureMappingMode::instance()));
break; break;
case '3': case '3':
_cmdManager.exec( setProjectionMode();
new ofx::piMapper::SetApplicationModeCmd(
this, ProjectionMappingMode::instance()));
break; break;
case '4': case '4':
_cmdManager.exec( setSourceMode();
new ofx::piMapper::SetApplicationModeCmd(
this, SourceSelectionMode::instance()));
break; break;
case 'f': case 'f':
@ -260,5 +252,29 @@ bool Application::loadXmlSettings(string fileName){
return true; 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 piMapper
} // namespace ofx } // namespace ofx

5
src/Application/Application.h

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

Loading…
Cancel
Save