Browse Source

Add ofxPiMapper::setActivePreset and getNumPresets

master
Krisjanis Rijnieks 9 years ago
parent
commit
4678c76c4f
  1. 12
      src/Surfaces/SurfaceManager.cpp
  2. 3
      src/Surfaces/SurfaceManager.h
  3. 10
      src/ofxPiMapper.cpp
  4. 6
      src/ofxPiMapper.h

12
src/Surfaces/SurfaceManager.cpp

@ -427,5 +427,17 @@ void SurfaceManager::setNextPreset(){
// TODO: Create command for this.
}
void SurfaceManager::setActivePreset(unsigned int i){
if(_presets.size() <= 1){
throw runtime_error("ofxPiMapper: No presets to set.");
}
if(i >= _presets.size()){
throw runtime_error("ofxPiMapper: Preset index out of bounds.");
}
_activePresetIndex = i;
}
} // namespace piMapper
} // namespace ofx

3
src/Surfaces/SurfaceManager.h

@ -71,12 +71,13 @@ class SurfaceManager {
void onVertexChanged(int & i);
void onVerticesChanged(vector<ofVec3f> & vertices);
SurfaceStack * getActivePreset();
SurfaceStack * createPreset();
SurfaceStack * getPresetAt(unsigned int i);
void setNextPreset();
void setActivePreset(unsigned int i);
private:
BaseSurface * selectedSurface;

10
src/ofxPiMapper.cpp

@ -22,6 +22,14 @@ void ofxPiMapper::registerFboSource(ofx::piMapper::FboSource * fboSource){
_application.addFboSource(fboSource);
}
void ofxPiMapper::setActivePreset(unsigned int i){
_application.getSurfaceManager()->setActivePreset(i);
}
bool ofxPiMapper::loadXmlSettings(string fileName){
return _application.loadXmlSettings(fileName);
}
}
unsigned int ofxPiMapper::getNumPresets(){
return _application.getSurfaceManager()->getNumPresets();
}

6
src/ofxPiMapper.h

@ -27,8 +27,12 @@ class ofxPiMapper {
void registerFboSource(ofx::piMapper::FboSource & fboSource);
void registerFboSource(ofx::piMapper::FboSource * fboSource);
void setActivePreset(unsigned int i);
bool loadXmlSettings(string fileName);
unsigned int getNumPresets();
private:
ofx::piMapper::Application _application;
};
};

Loading…
Cancel
Save