Browse Source

Add ofxPiMapper::togglePerspective()

master
Krisjanis Rijnieks 8 years ago
parent
commit
687960c537
  1. 11
      src/Application/Application.cpp
  2. 1
      src/Application/Application.h
  3. 12
      src/Application/Modes/ProjectionMappingMode.cpp
  4. 4
      src/ofxPiMapper.cpp
  5. 1
      src/ofxPiMapper.h

11
src/Application/Application.cpp

@ -223,6 +223,17 @@ void Application::toggleInfo(){
_info.toggle();
}
void Application::togglePerspective(){
if(getSurfaceManager()->getSelectedSurface() == 0){
return;
}
if(getSurfaceManager()->getSelectedSurface()->getType() == SurfaceType::QUAD_SURFACE){
getCmdManager()->exec(new TogglePerspectiveCmd(
(QuadSurface *)getSurfaceManager()->getSelectedSurface()));
}
}
void Application::saveProject(){
ofLogNotice("Application::saveProject", "Saving project...");
_surfaceManager.saveXmlSettings(SettingsLoader::instance()->getLastLoadedFilename());

1
src/Application/Application.h

@ -65,6 +65,7 @@ class Application : public KeyListener {
void eraseSurface(int i);
void setInfoText(string text);
void toggleInfo();
void togglePerspective();
void saveProject();
bool loadXmlSettings(string fileName);

12
src/Application/Modes/ProjectionMappingMode.cpp

@ -79,17 +79,7 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
break;
case 'p':
if(app->getSurfaceManager()->getSelectedSurface() == 0){
break;
}
if(app->getSurfaceManager()->getSelectedSurface()->getType() ==
SurfaceType::QUAD_SURFACE){
app->getCmdManager()->exec(
new TogglePerspectiveCmd(
(QuadSurface *)app->getSurfaceManager()->getSelectedSurface() ) );
}
app->togglePerspective();
break;
case '}':

4
src/ofxPiMapper.cpp

@ -83,6 +83,10 @@ void ofxPiMapper::selectSurface(int i){
_application.getState()->selectSurface(&_application, i);
}
void ofxPiMapper::togglePerspective(){
_application.togglePerspective();
}
void ofxPiMapper::selectNextSurface(){
_application.getState()->selectNextSurface(&_application);
}

1
src/ofxPiMapper.h

@ -48,6 +48,7 @@ class ofxPiMapper {
// Surfaces, active preset
unsigned int getNumSurfaces();
void selectSurface(int i);
void togglePerspective();
void selectNextSurface();
void selectPrevSurface();
void duplicateSurface();

Loading…
Cancel
Save