Browse Source

Add ofxPiMapper::setActivePreset and getNumPresets

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

12
src/Surfaces/SurfaceManager.cpp

@ -427,5 +427,17 @@ void SurfaceManager::setNextPreset(){
// TODO: Create command for this. // 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 piMapper
} // namespace ofx } // namespace ofx

1
src/Surfaces/SurfaceManager.h

@ -77,6 +77,7 @@ class SurfaceManager {
SurfaceStack * getPresetAt(unsigned int i); SurfaceStack * getPresetAt(unsigned int i);
void setNextPreset(); void setNextPreset();
void setActivePreset(unsigned int i);
private: private:
BaseSurface * selectedSurface; BaseSurface * selectedSurface;

8
src/ofxPiMapper.cpp

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

4
src/ofxPiMapper.h

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