diff --git a/example/src/CustomSource.h b/example/src/CustomSource.h index 9a3ce04..a473d73 100644 --- a/example/src/CustomSource.h +++ b/example/src/CustomSource.h @@ -9,6 +9,6 @@ class CustomSource : public ofx::piMapper::FboSource { void update(); void draw(); - vector rects; - vector rectSpeeds; + std::vector rects; + std::vector rectSpeeds; }; \ No newline at end of file diff --git a/example/src/main.cpp b/example/src/main.cpp index 2c8ec5b..64e63d1 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -7,7 +7,7 @@ int main(int argc, char * argv[]){ bool fullscreen = false; - vector arguments = vector(argv, argv + argc); + std::vector arguments = std::vector(argv, argv + argc); for(int i = 0; i < arguments.size(); ++i){ if(arguments.at(i) == "-f"){ fullscreen = true; diff --git a/example/src/ofApp.h b/example/src/ofApp.h index 5718af7..aa07e98 100644 --- a/example/src/ofApp.h +++ b/example/src/ofApp.h @@ -8,8 +8,7 @@ #include "VideoSource.h" #include "magSlideShowSource.h" -class ofApp : public ofBaseApp -{ +class ofApp : public ofBaseApp{ public: void setup(); void update(); diff --git a/example_camera/src/CameraSource.cpp b/example_camera/src/CameraSource.cpp index 29f64e3..2513475 100644 --- a/example_camera/src/CameraSource.cpp +++ b/example_camera/src/CameraSource.cpp @@ -15,7 +15,7 @@ CameraSource::CameraSource(){ _videoGrabber.setup(_omxCameraSettings); #else - vector devices = _videoGrabber.listDevices(); + std::vector devices = _videoGrabber.listDevices(); _cameraFound = false; for(int i = 0; i < devices.size(); i++){ diff --git a/example_camera/src/main.cpp b/example_camera/src/main.cpp index d1b6467..602382f 100644 --- a/example_camera/src/main.cpp +++ b/example_camera/src/main.cpp @@ -6,7 +6,7 @@ int main(int argc, char * argv[]){ bool fullscreen = false; - vector arguments = vector(argv, argv + argc); + std::vector arguments = std::vector(argv, argv + argc); for(int i = 0; i < arguments.size(); ++i){ if(arguments.at(i) == "-f"){ fullscreen = true; diff --git a/example_gamepad/src/InputHandler.h b/example_gamepad/src/InputHandler.h index 9b7ff15..949a64d 100644 --- a/example_gamepad/src/InputHandler.h +++ b/example_gamepad/src/InputHandler.h @@ -1,6 +1,6 @@ #pragma once -// These are the strings reported by SDL2's SDL_JoystickGetGUIDString: +// These are the std::strings reported by SDL2's SDL_JoystickGetGUIDString: // https://wiki.libsdl.org/SDL_JoystickGetGUIDString #include diff --git a/example_gamepad/src/main.cpp b/example_gamepad/src/main.cpp index d1b6467..602382f 100644 --- a/example_gamepad/src/main.cpp +++ b/example_gamepad/src/main.cpp @@ -6,7 +6,7 @@ int main(int argc, char * argv[]){ bool fullscreen = false; - vector arguments = vector(argv, argv + argc); + std::vector arguments = std::vector(argv, argv + argc); for(int i = 0; i < arguments.size(); ++i){ if(arguments.at(i) == "-f"){ fullscreen = true; diff --git a/example_shortcuts/src/ofApp.cpp b/example_shortcuts/src/ofApp.cpp index 6d3155e..c696003 100644 --- a/example_shortcuts/src/ofApp.cpp +++ b/example_shortcuts/src/ofApp.cpp @@ -73,7 +73,7 @@ void ofApp::keyPressed(int key){ }else if(key == '\\'){ mapper.togglePause(); }else if(key == 'n'){ - string multilineInfoText = + std::string multilineInfoText = "Custom ofxPiMapper shortcuts\n\n" "Good day user.\n" "Shortcuts have been customized.\n" diff --git a/example_simpler/src/CustomSource.h b/example_simpler/src/CustomSource.h index 9a3ce04..a473d73 100644 --- a/example_simpler/src/CustomSource.h +++ b/example_simpler/src/CustomSource.h @@ -9,6 +9,6 @@ class CustomSource : public ofx::piMapper::FboSource { void update(); void draw(); - vector rects; - vector rectSpeeds; + std::vector rects; + std::vector rectSpeeds; }; \ No newline at end of file diff --git a/example_simpler/src/main.cpp b/example_simpler/src/main.cpp index e5733f9..764dcff 100644 --- a/example_simpler/src/main.cpp +++ b/example_simpler/src/main.cpp @@ -7,7 +7,7 @@ int main(int argc, char * argv[]){ bool fullscreen = false; - vector arguments = vector(argv, argv + argc); + std::vector arguments = std::vector(argv, argv + argc); for(int i = 0; i < arguments.size(); ++i){ if(arguments.at(i) == "-f"){ fullscreen = true; diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 12569a1..bdc0a77 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -199,7 +199,7 @@ void Application::eraseSurface(int i){ } } -void Application::setInfoText(string text){ +void Application::setInfoText(std::string text){ _info.setText(text); } @@ -265,13 +265,13 @@ void Application::shutdown(){ #endif } -bool Application::loadXmlSettings(string fileName){ +bool Application::loadXmlSettings(std::string fileName){ if(!ofFile::doesFileExist(fileName)){ ofLogError("Application::loadXmlSettings()") << fileName << " does not exist"; return false; } if(!_surfaceManager.loadXmlSettings(fileName)){ - ofLogError("Application::loadXmlSettings()") << "Failed to load " << fileName << endl; + ofLogError("Application::loadXmlSettings()") << "Failed to load " << fileName << std::endl; return false; } return true; @@ -464,7 +464,7 @@ void Application::setNextSource(){ } } -void Application::setFboSource(string sourceId){ +void Application::setFboSource(std::string sourceId){ if(getSurfaceManager()->getSelectedSurface() != 0){ getCmdManager()->exec( new SetSourceCmd( diff --git a/src/Application/Application.h b/src/Application/Application.h index b3cfc0f..fd89275 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -1,5 +1,7 @@ #pragma once +#include + // OpenFrameworks components #include "ofEvents.h" #include "ofLog.h" @@ -87,11 +89,11 @@ class Application { void addFboSource(FboSource * fboSource); void createSurface(SurfaceType type); void eraseSurface(int i); - void setInfoText(string text); + void setInfoText(std::string text); void toggleInfo(); void togglePerspective(); void saveProject(); - bool loadXmlSettings(string fileName); + bool loadXmlSettings(std::string fileName); bool isShiftKeyDown(); @@ -126,7 +128,7 @@ class Application { void scaleDown(); void duplicateSurface(); void setNextSource(); - void setFboSource(string sourceId); + void setFboSource(std::string sourceId); void addGridRow(); void addGridColumn(); void removeGridRow(); @@ -164,7 +166,7 @@ class Application { float _lastSaveTime; float _autoSaveInterval; - string _keySequence; + std::string _keySequence; }; diff --git a/src/Application/SettingsLoader.cpp b/src/Application/SettingsLoader.cpp index c916555..4937709 100644 --- a/src/Application/SettingsLoader.cpp +++ b/src/Application/SettingsLoader.cpp @@ -19,11 +19,11 @@ SettingsLoader::SettingsLoader(){ bool SettingsLoader::load( SurfaceManager & surfaceManager, MediaServer & mediaServer, - string fileName){ + std::string fileName){ ofxXmlSettings * xmlSettings = new ofxXmlSettings(); - string sourceType = ""; - string sourceName = ""; + std::string sourceType = ""; + std::string sourceName = ""; BaseSource * source = 0; @@ -38,7 +38,7 @@ bool SettingsLoader::load( // Count tags. unsigned int numPresets = xmlSettings->getNumTags("surfaces"); - cout << "numPresets: " << numPresets << endl; + std::cout << "numPresets: " << numPresets << std::endl; // Clear previous presets and surfaces first. surfaceManager.clearPresets(); @@ -79,10 +79,10 @@ bool SettingsLoader::load( }else{ // Construct full path - string dir = mediaServer.getDefaultMediaDir(typeEnum); - stringstream pathss; + std::string dir = mediaServer.getDefaultMediaDir(typeEnum); + std::stringstream pathss; pathss << ofToDataPath(dir, true) << sourceName; - string sourcePath = pathss.str(); + std::string sourcePath = pathss.str(); // Load media by using full path source = mediaServer.loadMedia(sourcePath, typeEnum); @@ -157,7 +157,7 @@ bool SettingsLoader::load( } // TODO: Save all presets, not just the active one. -bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ +bool SettingsLoader::save(SurfaceManager & surfaceManager, std::string fileName){ ofxXmlSettings * xmlSettings = new ofxXmlSettings(); @@ -178,7 +178,7 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ xmlSettings->pushTag("surface", i); xmlSettings->addTag("vertices"); xmlSettings->pushTag("vertices"); - vector vertices = surface->getVertices(); + std::vector vertices = surface->getVertices(); for(int j = 0; j < vertices.size(); j++){ xmlSettings->addTag("vertex"); xmlSettings->pushTag("vertex", j); @@ -194,7 +194,7 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ xmlSettings->addTag("texCoords"); xmlSettings->pushTag("texCoords"); - vector texCoords = surface->getTexCoords(); + std::vector texCoords = surface->getTexCoords(); for(int j = 0; j < texCoords.size(); j++){ xmlSettings->addTag("texCoord"); xmlSettings->pushTag("texCoord", j); @@ -207,10 +207,10 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ xmlSettings->addTag("source"); xmlSettings->pushTag("source"); - string sourceTypeName = SourceTypeHelper::GetSourceTypeHelperName(surface->getSource()->getType()); + std::string sourceTypeName = SourceTypeHelper::GetSourceTypeHelperName(surface->getSource()->getType()); xmlSettings->addValue("source-type", sourceTypeName); - string sourceName = surface->getSource()->getName(); + std::string sourceName = surface->getSource()->getName(); xmlSettings->addValue("source-name", (sourceName == "") ? "none" : sourceName); xmlSettings->popTag(); // source @@ -245,14 +245,14 @@ bool SettingsLoader::save(SurfaceManager & surfaceManager, string fileName){ xmlSettings->save(fileName); } -bool SettingsLoader::create(string fileName){ +bool SettingsLoader::create(std::string fileName){ ofxXmlSettings xml; xml.addTag("surfaces"); return xml.save(fileName); } BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ - vector vertices; + std::vector vertices; if(xmlSettings->tagExists("vertices")){ xmlSettings->pushTag("vertices"); @@ -287,7 +287,7 @@ BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ xmlSettings->popTag(); // vertices } - vector texCoords; + std::vector texCoords; if(xmlSettings->tagExists("texCoords")){ xmlSettings->pushTag("texCoords"); @@ -327,7 +327,7 @@ BaseSurface * SettingsLoader::getTriangleSurface(ofxXmlSettings * xmlSettings){ } BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ - vector vertices; + std::vector vertices; if(xmlSettings->tagExists("vertices")){ xmlSettings->pushTag("vertices"); @@ -371,7 +371,7 @@ BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ xmlSettings->popTag(); // vertices } - vector texCoords; + std::vector texCoords; if(xmlSettings->tagExists("texCoords")){ xmlSettings->pushTag("texCoords"); @@ -429,7 +429,7 @@ BaseSurface * SettingsLoader::getQuadSurface(ofxXmlSettings * xmlSettings){ } BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ - vector vertices; + std::vector vertices; if(xmlSettings->tagExists("vertices")){ xmlSettings->pushTag("vertices"); @@ -449,7 +449,7 @@ BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ xmlSettings->popTag(); // vertices } - vector texCoords; + std::vector texCoords; if(xmlSettings->tagExists("texCoords")){ xmlSettings->pushTag("texCoords"); @@ -492,7 +492,7 @@ BaseSurface * SettingsLoader::getGridWarpSurface(ofxXmlSettings * xmlSettings){ } BaseSurface * SettingsLoader::getHexagonSurface(ofxXmlSettings * xmlSettings){ - vector vertices; + std::vector vertices; if(xmlSettings->tagExists("vertices")){ xmlSettings->pushTag("vertices"); @@ -511,7 +511,7 @@ BaseSurface * SettingsLoader::getHexagonSurface(ofxXmlSettings * xmlSettings){ xmlSettings->popTag(); // vertices } - vector texCoords; + std::vector texCoords; if(xmlSettings->tagExists("texCoords")){ xmlSettings->pushTag("texCoords"); diff --git a/src/Application/SettingsLoader.h b/src/Application/SettingsLoader.h index fab1626..3e1f2e6 100644 --- a/src/Application/SettingsLoader.h +++ b/src/Application/SettingsLoader.h @@ -20,11 +20,11 @@ class SettingsLoader { public: static SettingsLoader * instance(); - bool load(SurfaceManager & surfaceManager, MediaServer & mediaServer, string fileName); - bool save(SurfaceManager & surfaceManager, string fileName); - bool create(string fileName); + bool load(SurfaceManager & surfaceManager, MediaServer & mediaServer, std::string fileName); + bool save(SurfaceManager & surfaceManager, std::string fileName); + bool create(std::string fileName); - string getLastLoadedFilename(){ return _lastLoadedFilename; }; + std::string getLastLoadedFilename(){ return _lastLoadedFilename; }; private: static SettingsLoader * _instance; @@ -36,7 +36,7 @@ class SettingsLoader { BaseSurface * getGridWarpSurface(ofxXmlSettings * xmlSettings); BaseSurface * getHexagonSurface(ofxXmlSettings * xmlSettings); - string _lastLoadedFilename; + std::string _lastLoadedFilename; }; } // namespace piMapper diff --git a/src/Commands/AddGridColCmd.h b/src/Commands/AddGridColCmd.h index 0e37ad8..f8a6b84 100644 --- a/src/Commands/AddGridColCmd.h +++ b/src/Commands/AddGridColCmd.h @@ -20,8 +20,8 @@ class AddGridColCmd : public BaseUndoCmd { void undo(); private: - vector _vertices; - vector _texCoords; + std::vector _vertices; + std::vector _texCoords; GridWarpSurface * _surface; }; diff --git a/src/Commands/AddGridRowCmd.h b/src/Commands/AddGridRowCmd.h index 6b324ce..0cc3c10 100644 --- a/src/Commands/AddGridRowCmd.h +++ b/src/Commands/AddGridRowCmd.h @@ -20,8 +20,8 @@ class AddGridRowCmd : public BaseUndoCmd { void undo(); private: - vector _vertices; - vector _texCoords; + std::vector _vertices; + std::vector _texCoords; GridWarpSurface * _surface; }; diff --git a/src/Commands/ClearSurfacesCmd.h b/src/Commands/ClearSurfacesCmd.h index c24f603..a29b119 100644 --- a/src/Commands/ClearSurfacesCmd.h +++ b/src/Commands/ClearSurfacesCmd.h @@ -22,7 +22,7 @@ class ClearSurfacesCmd : public BaseUndoCmd { private: // Here it would make sense to have another instance of SurfaceStack - vector _surfaces; + std::vector _surfaces; SurfaceManager * _surfaceManager; BaseSurface * _selectedSurface; diff --git a/src/Commands/CmdManager.h b/src/Commands/CmdManager.h index a09f7d3..9628c33 100644 --- a/src/Commands/CmdManager.h +++ b/src/Commands/CmdManager.h @@ -14,9 +14,9 @@ class CmdManager { void undo(); private: - vector cmdStack; + std::vector cmdStack; }; } // namespace piMapper -} // namespace ofx \ No newline at end of file +} // namespace ofx diff --git a/src/Commands/DeselectTexCoordCmd.cpp b/src/Commands/DeselectTexCoordCmd.cpp index 9e1c8ee..6a12984 100644 --- a/src/Commands/DeselectTexCoordCmd.cpp +++ b/src/Commands/DeselectTexCoordCmd.cpp @@ -11,7 +11,7 @@ void DeselectTexCoordCmd::exec(){ ofLogNotice("DeselectTexCoordCmd", "exec"); _selectedTexCoord = -1; - vector joints = _textureEditor->getJoints(); + std::vector joints = _textureEditor->getJoints(); for(unsigned int i = 0; i < joints.size(); ++i){ if(joints[i]->isSelected()){ _selectedTexCoord = i; diff --git a/src/Commands/MvAllTexCoordsCmd.h b/src/Commands/MvAllTexCoordsCmd.h index 3253f09..b6601e5 100644 --- a/src/Commands/MvAllTexCoordsCmd.h +++ b/src/Commands/MvAllTexCoordsCmd.h @@ -20,7 +20,7 @@ class MvAllTexCoordsCmd : public BaseUndoCmd { void undo(); private: - vector _texCoords; + std::vector _texCoords; BaseSurface * _surface; TextureEditorWidget * _texEditor; diff --git a/src/Commands/RmGridColCmd.h b/src/Commands/RmGridColCmd.h index f79a46b..ced88d6 100644 --- a/src/Commands/RmGridColCmd.h +++ b/src/Commands/RmGridColCmd.h @@ -20,8 +20,8 @@ class RmGridColCmd : public BaseUndoCmd { void undo(); private: - vector _vertices; - vector _texCoords; + std::vector _vertices; + std::vector _texCoords; GridWarpSurface * _surface; bool _doNotUndo; diff --git a/src/Commands/RmGridRowCmd.h b/src/Commands/RmGridRowCmd.h index c1973e0..32d2c3e 100644 --- a/src/Commands/RmGridRowCmd.h +++ b/src/Commands/RmGridRowCmd.h @@ -20,8 +20,8 @@ class RmGridRowCmd : public BaseUndoCmd { void undo(); private: - vector _vertices; - vector _texCoords; + std::vector _vertices; + std::vector _texCoords; GridWarpSurface * _surface; bool _doNotUndo; diff --git a/src/Commands/SetNextSourceCmd.cpp b/src/Commands/SetNextSourceCmd.cpp index d55d5d7..775bcc3 100644 --- a/src/Commands/SetNextSourceCmd.cpp +++ b/src/Commands/SetNextSourceCmd.cpp @@ -15,7 +15,7 @@ void SetNextSourceCmd::exec(){ BaseSource * source = _surface->getSource(); int sourceType = source->getType(); - string sourceId; + std::string sourceId; if(source->isLoadable()){ sourceId = source->getPath(); }else{ diff --git a/src/Commands/SetNextSourceCmd.h b/src/Commands/SetNextSourceCmd.h index f31c028..b0dada9 100644 --- a/src/Commands/SetNextSourceCmd.h +++ b/src/Commands/SetNextSourceCmd.h @@ -11,7 +11,7 @@ namespace piMapper { struct SourceData { int type; - string id; + std::string id; }; class SourcesEditorWidget; @@ -26,7 +26,7 @@ class SetNextSourceCmd : public BaseUndoCmd { private: BaseSurface * _surface; SourcesEditorWidget * _sourcesEditor; - vector _sources; + std::vector _sources; int _sourceIndex; // Previous source index int _nextSourceIndex; diff --git a/src/Commands/SetSourceCmd.cpp b/src/Commands/SetSourceCmd.cpp index 984155b..9871a31 100644 --- a/src/Commands/SetSourceCmd.cpp +++ b/src/Commands/SetSourceCmd.cpp @@ -4,7 +4,7 @@ namespace ofx { namespace piMapper { SetSourceCmd::SetSourceCmd(int sourceType, - string sourceId, + std::string sourceId, BaseSurface * surface, SourcesEditorWidget * sourcesEditor){ diff --git a/src/Commands/SetSourceCmd.h b/src/Commands/SetSourceCmd.h index ac639c8..fb818fe 100644 --- a/src/Commands/SetSourceCmd.h +++ b/src/Commands/SetSourceCmd.h @@ -17,7 +17,7 @@ class SetSourceCmd : public BaseUndoCmd { public: SetSourceCmd(int sourceType, - string sourceId, + std::string sourceId, BaseSurface * surface, SourcesEditorWidget * sourcesEditor); void exec(); @@ -25,12 +25,12 @@ class SetSourceCmd : public BaseUndoCmd { private: int _sourceType; - string _sourceId; + std::string _sourceId; BaseSurface * _surface; SourcesEditorWidget * _sourcesEditor; int _oldSourceTypeHelper; - string _oldSourceId; + std::string _oldSourceId; }; diff --git a/src/Commands/StartDragSurfaceCmd.h b/src/Commands/StartDragSurfaceCmd.h index e28b878..e46ddda 100644 --- a/src/Commands/StartDragSurfaceCmd.h +++ b/src/Commands/StartDragSurfaceCmd.h @@ -16,7 +16,7 @@ class StartDragSurfaceCmd : public BaseUndoCmd { private: BaseSurface * _surface; - vector _previousVertices; + std::vector _previousVertices; }; diff --git a/src/Gui/Widgets/LayerPanelWidget.cpp b/src/Gui/Widgets/LayerPanelWidget.cpp index f9cb2ec..bb59b78 100644 --- a/src/Gui/Widgets/LayerPanelWidget.cpp +++ b/src/Gui/Widgets/LayerPanelWidget.cpp @@ -35,7 +35,7 @@ void LayerPanelWidget::draw(){ int layerIconX = ofGetWidth() - offsetRight - layerIconWidth; int layerIconY = offsetTop + ((layerIconHeight + verticalSpacing) * (numSurfaces - i - 1)); - string label = "Layers"; + std::string label = "Layers"; ofDrawBitmapString(label, ofGetWidth() - 66, 30); ofRectangle layerIcon = ofRectangle( diff --git a/src/Gui/Widgets/ProjectionEditorWidget.cpp b/src/Gui/Widgets/ProjectionEditorWidget.cpp index 8d860f7..5693a9a 100644 --- a/src/Gui/Widgets/ProjectionEditorWidget.cpp +++ b/src/Gui/Widgets/ProjectionEditorWidget.cpp @@ -53,7 +53,7 @@ void ProjectionEditorWidget::mouseDragged(ofMouseEventArgs & args){ Vec2 mousePosition = Vec2(args.x, args.y); // Collect all vertices of the projection surfaces - vector allVertices; + std::vector allVertices; for(int i = 0; i < surfaceManager->size(); i++){ BaseSurface * surface = surfaceManager->getSurface(i); @@ -137,7 +137,7 @@ void ProjectionEditorWidget::createJoints(){ return; } - vector vertices = surfaceManager->getSelectedSurface()->getVertices(); + std::vector vertices = surfaceManager->getSelectedSurface()->getVertices(); for(int i = 0; i < vertices.size(); i++){ joints.push_back(new CircleJoint()); @@ -147,7 +147,7 @@ void ProjectionEditorWidget::createJoints(){ void ProjectionEditorWidget::updateJoints(){ if(surfaceManager->getSelectedSurface()){ - vector vertices = surfaceManager->getSelectedSurface()->getVertices(); + std::vector vertices = surfaceManager->getSelectedSurface()->getVertices(); for(int i = 0; i < vertices.size(); i++){ joints[i]->position = Vec2(vertices[i].x, vertices[i].y); @@ -197,7 +197,7 @@ CircleJoint * ProjectionEditorWidget::hitTestJoints(Vec2 pos){ return 0; } -vector * ProjectionEditorWidget::getJoints(){ +std::vector * ProjectionEditorWidget::getJoints(){ return &joints; } @@ -212,7 +212,7 @@ void ProjectionEditorWidget::onVertexChanged(int & i){ } } -void ProjectionEditorWidget::onVerticesChanged(vector & vertices){ +void ProjectionEditorWidget::onVerticesChanged(std::vector & vertices){ createJoints(); } diff --git a/src/Gui/Widgets/ProjectionEditorWidget.h b/src/Gui/Widgets/ProjectionEditorWidget.h index 032c642..58037e9 100644 --- a/src/Gui/Widgets/ProjectionEditorWidget.h +++ b/src/Gui/Widgets/ProjectionEditorWidget.h @@ -29,17 +29,17 @@ class ProjectionEditorWidget { void updateVertices(); void setSnapDistance(float newSnapDistance); CircleJoint * hitTestJoints(Vec2 pos); - vector * getJoints(); + std::vector * getJoints(); void onVertexChanged(int & i); - void onVerticesChanged(vector & vertices); + void onVerticesChanged(std::vector & vertices); void onSurfaceSelected(int & surfaceIndex); void onVertexSelected(int & vertexIndex); void onVertexUnselected(int & vertexIndex); private: SurfaceManager * surfaceManager; - vector joints; + std::vector joints; bool bShiftKeyDown; float fSnapDistance; diff --git a/src/Gui/Widgets/ScaleWidget.cpp b/src/Gui/Widgets/ScaleWidget.cpp index 2c1367e..a4e192f 100644 --- a/src/Gui/Widgets/ScaleWidget.cpp +++ b/src/Gui/Widgets/ScaleWidget.cpp @@ -1,4 +1,5 @@ #include "ScaleWidget.h" +#include "glm/geometric.hpp" namespace ofx { namespace piMapper { @@ -57,7 +58,11 @@ void ScaleWidget::draw(){ _line[1].y -= dy; // Continue - float scale = lineLength / _line[0].distance(_line[1]); + #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 + float scale = lineLength / _line[0].distance(_line[1]); + #else + float scale = lineLength / glm::distance(_line[0], _line[1]); + #endif _line[1].x = _line[0].x + (_line[1].x - _line[0].x) * scale; _line[1].y = _line[0].y + (_line[1].y - _line[0].y) * scale; @@ -128,9 +133,15 @@ void ScaleWidget::onMouseDragged(ofMouseEventArgs & args){ newLine[1].x = args.x; newLine[1].y = args.y; - _scale = _surfaceManager->getSelectedSurface()->getScale() / - _line[0].distance(_line[1]) * - newLine[0].distance(newLine[1]); + #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 + _scale = _surfaceManager->getSelectedSurface()->getScale() / + _line[0].distance(_line[1]) * + newLine[0].distance(newLine[1]); + #else + _scale = _surfaceManager->getSelectedSurface()->getScale() / + glm::distance(_line[0], _line[1]) * + glm::distance(newLine[0], newLine[1]); + #endif _line = newLine; diff --git a/src/Gui/Widgets/SourcesEditorWidget.cpp b/src/Gui/Widgets/SourcesEditorWidget.cpp index 5dd7517..7af2134 100644 --- a/src/Gui/Widgets/SourcesEditorWidget.cpp +++ b/src/Gui/Widgets/SourcesEditorWidget.cpp @@ -23,17 +23,17 @@ void SourcesEditorWidget::createSelectors(){ // Depending on media count, decide what to load and initialize if(numImages){ // Get image names from media server - vector imageNames = mediaServer->getImageNames(); + std::vector imageNames = mediaServer->getImageNames(); imageSelector->setup("Images", imageNames, mediaServer->getImagePaths()); ofAddListener(imageSelector->onRadioSelected, this, &SourcesEditorWidget::handleImageSelected); } if(numVideos){ - vector videoNames = mediaServer->getVideoNames(); + std::vector videoNames = mediaServer->getVideoNames(); videoSelector->setup("Videos", videoNames, mediaServer->getVideoPaths()); ofAddListener(videoSelector->onRadioSelected, this, &SourcesEditorWidget::handleVideoSelected); } if(numFbos){ - vector fboNames = mediaServer->getFboSourceNames(); + std::vector fboNames = mediaServer->getFboSourceNames(); fboSelector->setup("FBOs", fboNames, fboNames); ofAddListener(fboSelector->onRadioSelected, this, &SourcesEditorWidget::handleFboSelected); } @@ -135,7 +135,7 @@ MediaServer * SourcesEditorWidget::getMediaServer(){ return mediaServer; } -void SourcesEditorWidget::selectSourceRadioButton(string & sourcePath){ +void SourcesEditorWidget::selectSourceRadioButton(std::string & sourcePath){ if(sourcePath == ""){ ofLogNotice("SourcesEditorWidget") << "Path is empty"; if(imageSelector->size()){ @@ -210,14 +210,14 @@ void SourcesEditorWidget::removeMediaServerListeners(){ ofRemoveListener(mediaServer->onFboSourceUnloaded, this, &SourcesEditorWidget::handleFboSourceUnloaded); } -void SourcesEditorWidget::handleImageSelected(string & imagePath){ +void SourcesEditorWidget::handleImageSelected(std::string & imagePath){ _cmdManager->exec(new SetSourceCmd(SourceType::SOURCE_TYPE_IMAGE, imagePath, surfaceManager->getSelectedSurface(), (SourcesEditorWidget *)this)); } -void SourcesEditorWidget::setImageSource(string & imagePath){ +void SourcesEditorWidget::setImageSource(std::string & imagePath){ // Unselect selected items videoSelector->unselectAll(); fboSelector->unselectAll(); @@ -240,14 +240,14 @@ void SourcesEditorWidget::setImageSource(string & imagePath){ surface->setSource(mediaServer->loadImage(imagePath)); } -void SourcesEditorWidget::handleVideoSelected(string & videoPath){ +void SourcesEditorWidget::handleVideoSelected(std::string & videoPath){ _cmdManager->exec(new SetSourceCmd(SourceType::SOURCE_TYPE_VIDEO, videoPath, surfaceManager->getSelectedSurface(), (SourcesEditorWidget *)this)); } -void SourcesEditorWidget::setVideoSource(string & videoPath){ +void SourcesEditorWidget::setVideoSource(std::string & videoPath){ // Unselect any selected items fboSelector->unselectAll(); imageSelector->unselectAll(); @@ -270,14 +270,14 @@ void SourcesEditorWidget::setVideoSource(string & videoPath){ surface->setSource(mediaServer->loadVideo(videoPath)); } -void SourcesEditorWidget::handleFboSelected(string & fboName){ +void SourcesEditorWidget::handleFboSelected(std::string & fboName){ _cmdManager->exec(new SetSourceCmd(SourceType::SOURCE_TYPE_FBO, fboName, surfaceManager->getSelectedSurface(), (SourcesEditorWidget *)this)); } -void SourcesEditorWidget::setFboSource(string & fboName){ +void SourcesEditorWidget::setFboSource(std::string & fboName){ videoSelector->unselectAll(); imageSelector->unselectAll(); @@ -325,21 +325,21 @@ void SourcesEditorWidget::clearMediaServer(){ } // TODO: There is no need for those at the moment. They add too much overhead. -void SourcesEditorWidget::handleImageAdded(string & path){ +void SourcesEditorWidget::handleImageAdded(std::string & path){ ofLogNotice("SourcesEditorWidget::handleImageAdded") << "Image path: " << path; } -void SourcesEditorWidget::handleImageRemoved(string & path){} -void SourcesEditorWidget::handleVideoAdded(string & path){} -void SourcesEditorWidget::handleVideoRemoved(string & path){} -void SourcesEditorWidget::handleImageLoaded(string & path){} -void SourcesEditorWidget::handleImageUnloaded(string & path){} -void SourcesEditorWidget::handleFboSourceAdded(string & name){} -void SourcesEditorWidget::handleFboSourceRemoved(string & name){} -void SourcesEditorWidget::handleFboSourceLoaded(string & name){} -void SourcesEditorWidget::handleFboSourceUnloaded(string & name){} +void SourcesEditorWidget::handleImageRemoved(std::string & path){} +void SourcesEditorWidget::handleVideoAdded(std::string & path){} +void SourcesEditorWidget::handleVideoRemoved(std::string & path){} +void SourcesEditorWidget::handleImageLoaded(std::string & path){} +void SourcesEditorWidget::handleImageUnloaded(std::string & path){} +void SourcesEditorWidget::handleFboSourceAdded(std::string & name){} +void SourcesEditorWidget::handleFboSourceRemoved(std::string & name){} +void SourcesEditorWidget::handleFboSourceLoaded(std::string & name){} +void SourcesEditorWidget::handleFboSourceUnloaded(std::string & name){} } // namespace piMapper } // namespace ofx \ No newline at end of file diff --git a/src/Gui/Widgets/SourcesEditorWidget.h b/src/Gui/Widgets/SourcesEditorWidget.h index b5dbaea..59c6278 100644 --- a/src/Gui/Widgets/SourcesEditorWidget.h +++ b/src/Gui/Widgets/SourcesEditorWidget.h @@ -17,7 +17,7 @@ class SourcesEditorWidget { void setup(); void draw(); - void loadImage(string name, string path); + void loadImage(std::string name, std::string path); void disable(); void enable(); void setSurfaceManager(SurfaceManager * newSurfaceManager); @@ -26,15 +26,15 @@ class SourcesEditorWidget { // Sets external MediaServer void setMediaServer(MediaServer * newMediaServer); MediaServer * getMediaServer(); - //void selectImageSourceRadioButton(string name); - void selectSourceRadioButton(string & sourcePath); + //void selectImageSourceRadioButton(std::string name); + void selectSourceRadioButton(std::string & sourcePath); int getLoadedTexCount(); ofTexture * getTexture(int index); - void setImageSource(string & imagePath); - void setVideoSource(string & videoPath); - void setFboSource(string & fboName); + void setImageSource(std::string & imagePath); + void setVideoSource(std::string & videoPath); + void setFboSource(std::string & fboName); void clearSource(); private: @@ -53,25 +53,25 @@ class SourcesEditorWidget { void removeMediaServerListeners(); // Handles GUI event, whenever someone has clicked on a radio button - void handleImageSelected(string & imagePath); - void handleVideoSelected(string & videoPath); - void handleFboSelected(string & fboName); + void handleImageSelected(std::string & imagePath); + void handleVideoSelected(std::string & videoPath); + void handleFboSelected(std::string & fboName); // Careful clearing of the media server, // clears only if the media server has been initialized locally void clearMediaServer(); // MediaServer event handlers - void handleImageAdded(string & path); - void handleImageRemoved(string & path); - void handleVideoAdded(string & path); - void handleVideoRemoved(string & path); - void handleImageLoaded(string & path); - void handleImageUnloaded(string & path); - void handleFboSourceAdded(string & name); - void handleFboSourceRemoved(string & name); - void handleFboSourceLoaded(string & name); - void handleFboSourceUnloaded(string & name); + void handleImageAdded(std::string & path); + void handleImageRemoved(std::string & path); + void handleVideoAdded(std::string & path); + void handleVideoRemoved(std::string & path); + void handleImageLoaded(std::string & path); + void handleImageUnloaded(std::string & path); + void handleFboSourceAdded(std::string & name); + void handleFboSourceRemoved(std::string & name); + void handleFboSourceLoaded(std::string & name); + void handleFboSourceUnloaded(std::string & name); }; diff --git a/src/Gui/Widgets/TextureEditorWidget.cpp b/src/Gui/Widgets/TextureEditorWidget.cpp index d4da08e..b84d7fc 100644 --- a/src/Gui/Widgets/TextureEditorWidget.cpp +++ b/src/Gui/Widgets/TextureEditorWidget.cpp @@ -44,7 +44,7 @@ void TextureEditorWidget::update(){ if(surface->getType() == SurfaceType::GRID_WARP_SURFACE){ GridWarpSurface * s = (GridWarpSurface *)surface; - vector texCoords = surface->getTexCoords(); + std::vector texCoords = surface->getTexCoords(); Vec2 textureSize = Vec2( surface->getSource()->getTexture()->getWidth(), surface->getSource()->getTexture()->getHeight()); @@ -134,7 +134,7 @@ void TextureEditorWidget::createJoints(){ } clearJoints(); - vector texCoords = surface->getTexCoords(); + std::vector texCoords = surface->getTexCoords(); if(surface->getSource()->getTexture()->isAllocated()){ _pollCreateJoints = false; @@ -148,7 +148,7 @@ void TextureEditorWidget::createJoints(){ surface->getSource()->getTexture()->getHeight()); // Select joints depending on the surface type - vector tc; + std::vector tc; if(surface->getType() == SurfaceType::TRIANGLE_SURFACE){ tc = texCoords; @@ -282,7 +282,7 @@ void TextureEditorWidget::moveTexCoords(Vec2 by){ return; } - vector texCoords = surface->getTexCoords(); + std::vector texCoords = surface->getTexCoords(); Vec2 textureSize = Vec2( surface->getSource()->getTexture()->getWidth(), surface->getSource()->getTexture()->getHeight()); @@ -407,7 +407,7 @@ CircleJoint * TextureEditorWidget::hitTestJoints(Vec2 pos){ return 0; } -vector & TextureEditorWidget::getJoints(){ +std::vector & TextureEditorWidget::getJoints(){ return joints; } diff --git a/src/Gui/Widgets/TextureEditorWidget.h b/src/Gui/Widgets/TextureEditorWidget.h index dfb2a6e..6bd3ee5 100644 --- a/src/Gui/Widgets/TextureEditorWidget.h +++ b/src/Gui/Widgets/TextureEditorWidget.h @@ -46,11 +46,11 @@ class TextureEditorWidget : public GuiBaseWidget { void moveSelection(Vec2 by); void constrainJointsToQuad(int selectedJointIndex); CircleJoint * hitTestJoints(Vec2 pos); - vector & getJoints(); + std::vector & getJoints(); private: BaseSurface * surface; - vector joints; + std::vector joints; bool bShiftKeyDown; bool _pollCreateJoints; diff --git a/src/Gui/Widgets/TextureHighlightWidget.h b/src/Gui/Widgets/TextureHighlightWidget.h index 9ea51ae..27353d9 100644 --- a/src/Gui/Widgets/TextureHighlightWidget.h +++ b/src/Gui/Widgets/TextureHighlightWidget.h @@ -27,7 +27,7 @@ class TextureHighlightWidget : public GuiBaseWidget { private: SurfaceManager * _sm; - vector _consumerSurfaces; + std::vector _consumerSurfaces; }; } // namespace piMapper diff --git a/src/Info/Info.cpp b/src/Info/Info.cpp index 7823ee0..82de484 100644 --- a/src/Info/Info.cpp +++ b/src/Info/Info.cpp @@ -51,7 +51,7 @@ void Info::toggle(){ _visible = !_visible; } -void Info::setText(string text){ +void Info::setText(std::string text){ _text = text; } diff --git a/src/Info/Info.h b/src/Info/Info.h index 3fa0dde..adc4616 100644 --- a/src/Info/Info.h +++ b/src/Info/Info.h @@ -11,11 +11,11 @@ class Info { void draw(); void toggle(); - void setText(string text); + void setText(std::string text); private: bool _visible; - string _text; + std::string _text; }; } // namespace piMapper diff --git a/src/MediaServer/DirectoryWatcher.cpp b/src/MediaServer/DirectoryWatcher.cpp index 104abcf..9c55e21 100644 --- a/src/MediaServer/DirectoryWatcher.cpp +++ b/src/MediaServer/DirectoryWatcher.cpp @@ -3,7 +3,7 @@ namespace ofx { namespace piMapper { -DirectoryWatcher::DirectoryWatcher(string path, int watcherMediaType){ +DirectoryWatcher::DirectoryWatcher(std::string path, int watcherMediaType){ directoryPath = path; _mediaType = watcherMediaType; @@ -41,11 +41,12 @@ DirectoryWatcher::DirectoryWatcher(string path, int watcherMediaType){ } DirectoryWatcher::~DirectoryWatcher() { - endWatch(); -// waitForThread(false); + if(isThreadRunning()){ + stopThread(); + } } -vector & DirectoryWatcher::getFilePaths(){ +std::vector & DirectoryWatcher::getFilePaths(){ return _filePaths; } @@ -58,10 +59,6 @@ void DirectoryWatcher::beginWatch(int intervalInMillis) { startThread(); } -void DirectoryWatcher::endWatch() { - stopThread(); -} - void DirectoryWatcher::threadedFunction() { while (isThreadRunning()) { diff --git a/src/MediaServer/DirectoryWatcher.h b/src/MediaServer/DirectoryWatcher.h index 8ef7ede..35ae34b 100644 --- a/src/MediaServer/DirectoryWatcher.h +++ b/src/MediaServer/DirectoryWatcher.h @@ -8,13 +8,12 @@ namespace piMapper { class DirectoryWatcher : public ofThread { public: - DirectoryWatcher(string path, int watcherMediaType); + DirectoryWatcher(std::string path, int watcherMediaType); virtual ~DirectoryWatcher(); - vector &getFilePaths(); + std::vector &getFilePaths(); int getMediaType(); void beginWatch(int intervalInMillis = 5000); - void endWatch(); void threadedFunction(); /** @@ -30,7 +29,7 @@ class DirectoryWatcher : public ofThread { private: ofDirectory _directory; - vector _filePaths; + std::vector _filePaths; std::string directoryPath; int _mediaType; @@ -39,4 +38,4 @@ class DirectoryWatcher : public ofThread { }; } // namespace piMapper -} // namespace ofx \ No newline at end of file +} // namespace ofx diff --git a/src/MediaServer/MediaServer.cpp b/src/MediaServer/MediaServer.cpp index 41b1747..01a6aeb 100644 --- a/src/MediaServer/MediaServer.cpp +++ b/src/MediaServer/MediaServer.cpp @@ -61,47 +61,47 @@ int MediaServer::getNumFboSources(){ return fboSources.size(); } -vector & MediaServer::getImagePaths(){ +std::vector & MediaServer::getImagePaths(){ return imageWatcher.getFilePaths(); } -vector MediaServer::getImageNames(){ - vector imageNames; +std::vector MediaServer::getImageNames(){ + std::vector imageNames; for(int i = 0; i < getNumImages(); i++){ // Split image path - vector pathParts = ofSplitString(getImagePaths()[i], "/"); + std::vector pathParts = ofSplitString(getImagePaths()[i], "/"); // And get only the last piece - string name = pathParts[pathParts.size() - 1]; + std::string name = pathParts[pathParts.size() - 1]; imageNames.push_back(name); } return imageNames; } -vector MediaServer::getFboSourceNames(){ - vector fboSourceNames; +std::vector MediaServer::getFboSourceNames(){ + std::vector fboSourceNames; for(int i = 0; i < fboSources.size(); i++){ fboSourceNames.push_back(fboSources[i]->getName()); } return fboSourceNames; } -vector & MediaServer::getVideoPaths(){ +std::vector & MediaServer::getVideoPaths(){ return videoWatcher.getFilePaths(); } -vector MediaServer::getVideoNames(){ - vector videoNames; +std::vector MediaServer::getVideoNames(){ + std::vector videoNames; for(int i = 0; i < getNumVideos(); i++){ // Split video path - vector pathParts = ofSplitString(getVideoPaths()[i], "/"); + std::vector pathParts = ofSplitString(getVideoPaths()[i], "/"); // And get only the last piece - string name = pathParts[pathParts.size() - 1]; + std::string name = pathParts[pathParts.size() - 1]; videoNames.push_back(name); } return videoNames; } -BaseSource * MediaServer::loadMedia(string & path, int mediaType){ +BaseSource * MediaServer::loadMedia(std::string & path, int mediaType){ // Chose load method depending on type if(mediaType == SourceType::SOURCE_TYPE_IMAGE){ return loadImage(path); @@ -110,7 +110,7 @@ BaseSource * MediaServer::loadMedia(string & path, int mediaType){ }else if(mediaType == SourceType::SOURCE_TYPE_FBO){ return loadFboSource(path); }else{ - stringstream ss; + std::stringstream ss; ss << "Can not load media of unknown type: " << mediaType; ofLogFatalError("MediaServer") << ss.str(); std::exit(EXIT_FAILURE); @@ -118,7 +118,7 @@ BaseSource * MediaServer::loadMedia(string & path, int mediaType){ return 0; } -BaseSource * MediaServer::loadImage(string & path){ +BaseSource * MediaServer::loadImage(std::string & path){ ImageSource * imageSource = 0; // Check if this image is already loaded bool isImageLoaded = false; @@ -131,11 +131,11 @@ BaseSource * MediaServer::loadImage(string & path){ // Increase reference count of this source //referenceCount[path]++; imageSource->referenceCount++; - stringstream refss; + std::stringstream refss; refss << "Current reference count for " << path << " = " << imageSource->referenceCount; ofLogNotice("MediaServer") << refss.str(); // Notify objects registered to onImageLoaded event - stringstream ss; + std::stringstream ss; ss << "Image " << path << " already loaded"; ofLogNotice("MediaServer") << ss.str(); ofNotifyEvent(onImageLoaded, path, this); @@ -147,7 +147,7 @@ BaseSource * MediaServer::loadImage(string & path){ loadedSources[path] = imageSource; // Set reference count of this image path to 1 //referenceCount[path] = 1; - stringstream refss; + std::stringstream refss; refss << "Initialized reference count of " << path << " to " << imageSource->referenceCount; ofLogNotice("MediaServer") << refss.str(); // Notify objects registered to onImageLoaded event @@ -155,7 +155,7 @@ BaseSource * MediaServer::loadImage(string & path){ return imageSource; } -void MediaServer::unloadImage(string & path){ +void MediaServer::unloadImage(std::string & path){ ImageSource * source = static_cast (getSourceByPath(path)); ofLogNotice("MediaServer") << "Unload image, current reference count: " << source->referenceCount; source->referenceCount--; @@ -166,28 +166,28 @@ void MediaServer::unloadImage(string & path){ return; } // Reference count 0 or less, unload image - stringstream ss; + std::stringstream ss; ss << "Removing image " << path; ofLogNotice("MediaServer") << ss.str(); // Destroy image source if(loadedSources.count(path)){ - ofLogNotice("MediaServer") << "Source count BEFORE image removal: " << loadedSources.size() << endl; + ofLogNotice("MediaServer") << "Source count BEFORE image removal: " << loadedSources.size() << std::endl; loadedSources[path]->clear(); - map ::iterator it = loadedSources.find(path); + map ::iterator it = loadedSources.find(path); delete it->second; loadedSources.erase(it); - ofLogNotice("MediaServer") << "Source count AFTER image removal: " << loadedSources.size() << endl; + ofLogNotice("MediaServer") << "Source count AFTER image removal: " << loadedSources.size() << std::endl; ofNotifyEvent(onImageUnloaded, path, this); return; } // Something wrong here, we should be out of the routine by now - stringstream failss; + std::stringstream failss; failss << "Failed to remove image source: " << path; ofLogFatalError("MediaServer") << failss.str(); std::exit(EXIT_FAILURE); } -BaseSource * MediaServer::loadVideo(string & path){ +BaseSource * MediaServer::loadVideo(std::string & path){ VideoSource * videoSource = 0; // Check if this video is already loaded bool isVideoLoaded = false; @@ -199,11 +199,11 @@ BaseSource * MediaServer::loadVideo(string & path){ if(isVideoLoaded){ // Increase reference count of this source videoSource->referenceCount++; - stringstream refss; + std::stringstream refss; refss << "Current reference count for " << path << " = " << videoSource->referenceCount; ofLogNotice("MediaServer") << refss.str(); // Notify objects registered to onImageLoaded event - stringstream ss; + std::stringstream ss; ss << "Video " << path << " already loaded"; ofLogNotice("MediaServer") << ss.str(); ofNotifyEvent(onVideoLoaded, path, this); @@ -215,14 +215,14 @@ BaseSource * MediaServer::loadVideo(string & path){ loadedSources[path] = videoSource; // Set reference count of this image path to 1 //referenceCount[path] = 1; - stringstream refss; + std::stringstream refss; refss << "Initialized reference count of " << path << " to " << videoSource->referenceCount; ofLogNotice("MediaServer") << refss.str(); ofNotifyEvent(onVideoLoaded, path, this); return videoSource; } -void MediaServer::unloadVideo(string & path){ +void MediaServer::unloadVideo(std::string & path){ VideoSource * videoSource = static_cast (getSourceByPath(path)); // Decrease reference count of the video //referenceCount[path]--; @@ -239,26 +239,26 @@ void MediaServer::unloadVideo(string & path){ if(loadedSources.count(path)){ ofLogNotice("MediaServer") << "Source count before video removal: " - << loadedSources.size() << endl; + << loadedSources.size() << std::endl; videoSource->clear(); - map ::iterator it = loadedSources.find(path); + map ::iterator it = loadedSources.find(path); delete it->second; loadedSources.erase(it); ofLogNotice("MediaServer") << "Source count after video removal: " - << loadedSources.size() << endl; + << loadedSources.size() << std::endl; ofNotifyEvent(onVideoUnloaded, path, this); return; } // Something wrong here, we should be out of the routine by now - stringstream failss; + std::stringstream failss; failss << "Failed to remove video source: " << path; ofLogFatalError("MediaServer") << failss.str(); std::exit(EXIT_FAILURE); } -void MediaServer::unloadMedia(string & path){ +void MediaServer::unloadMedia(std::string & path){ if(loadedSources.count(path)){ BaseSource * mediaSource = getSourceByPath(path); if(mediaSource->getType() == SourceType::SOURCE_TYPE_IMAGE){ @@ -279,7 +279,7 @@ void MediaServer::unloadMedia(string & path){ // Clear all loaded media void MediaServer::clear(){ - typedef map ::iterator it_type; + typedef map ::iterator it_type; for(it_type i = loadedSources.begin(); i != loadedSources.end(); i++){ // Do not delete FBO source pointers as they are (and should be) initialized elsewhere if(i->second->getType() != SourceType::SOURCE_TYPE_FBO){ @@ -290,32 +290,32 @@ void MediaServer::clear(){ } // TODO: getLoadedSourceByPath -BaseSource * MediaServer::getSourceByPath(string & mediaPath){ +BaseSource * MediaServer::getSourceByPath(std::string & mediaPath){ if(loadedSources.count(mediaPath)){ return loadedSources[mediaPath]; } // Source not found, exit with error - stringstream ss; + std::stringstream ss; ss << "Could not find source by path: " << mediaPath; ofLogFatalError("MediaServer") << ss.str(); std::exit(EXIT_FAILURE); } -string MediaServer::getDefaultImageDir(){ +std::string MediaServer::getDefaultImageDir(){ return DEFAULT_IMAGES_DIR; } -string MediaServer::getDefaultVideoDir(){ +std::string MediaServer::getDefaultVideoDir(){ return DEFAULT_VIDEOS_DIR; } -string MediaServer::getDefaultMediaDir(int sourceType){ +std::string MediaServer::getDefaultMediaDir(int sourceType){ if(sourceType == SourceType::SOURCE_TYPE_IMAGE){ return getDefaultImageDir(); }else if(sourceType == SourceType::SOURCE_TYPE_VIDEO){ return getDefaultVideoDir(); }else{ - stringstream ss; + std::stringstream ss; ss << "Could not get default media dir. Unknown source type: " << sourceType; ofLogFatalError("MediaServer") << ss.str(); std::exit(EXIT_FAILURE); @@ -346,7 +346,7 @@ void MediaServer::addFboSource(FboSource * fboSource){ fboSource->setup(); } -BaseSource * MediaServer::loadFboSource(string & fboSourceName){ +BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){ ofLogNotice("MediaServer") << "Attempting to load FBO source with name " << fboSourceName; // Search for FBO source name in our storage FboSource * source = 0; @@ -378,7 +378,7 @@ BaseSource * MediaServer::loadFboSource(string & fboSourceName){ return loadedSources[fboSourceName]; } // loadFboSource -void MediaServer::unloadFboSource(string & fboSourceName){ +void MediaServer::unloadFboSource(std::string & fboSourceName){ ofLogNotice("MediaServer") << "Attempt to unload FBO source " << fboSourceName; // Check if loaded at all if(!loadedSources.count(fboSourceName)){ @@ -396,9 +396,9 @@ void MediaServer::unloadFboSource(string & fboSourceName){ ofLogNotice("MediaServer") << fboSourceName << " reference count <= 0, removing from loaded sources"; source->referenceCount = 0; //source->removeAppListeners(); - map ::iterator it = loadedSources.find(fboSourceName); + map ::iterator it = loadedSources.find(fboSourceName); loadedSources.erase(it); - ofLogNotice("MediaServer") << "Source count after FBO source removal: " << loadedSources.size() << endl; + ofLogNotice("MediaServer") << "Source count after FBO source removal: " << loadedSources.size() << std::endl; ofNotifyEvent(onFboSourceUnloaded, fboSourceName, this); } } // unloadFboSource diff --git a/src/MediaServer/MediaServer.h b/src/MediaServer/MediaServer.h index 3f780f4..51bf721 100644 --- a/src/MediaServer/MediaServer.h +++ b/src/MediaServer/MediaServer.h @@ -55,45 +55,45 @@ class MediaServer { int getNumVideos(); int getNumImages(); int getNumFboSources(); // new - vector & getVideoPaths(); - vector getVideoNames(); - vector & getImagePaths(); - vector getImageNames(); - vector getFboSourceNames(); // new - - BaseSource * loadMedia(string & path, int mediaType); - BaseSource * loadImage(string & path); - void unloadImage(string & path); - BaseSource * loadVideo(string & path); - void unloadVideo(string & path); - void unloadMedia(string & path); + std::vector & getVideoPaths(); + std::vector getVideoNames(); + std::vector & getImagePaths(); + std::vector getImageNames(); + std::vector getFboSourceNames(); // new + + BaseSource * loadMedia(std::string & path, int mediaType); + BaseSource * loadImage(std::string & path); + void unloadImage(std::string & path); + BaseSource * loadVideo(std::string & path); + void unloadVideo(std::string & path); + void unloadMedia(std::string & path); void clear(); // Force all loaded source unload - BaseSource * getSourceByPath(string & mediaPath); - string getDefaultImageDir(); - string getDefaultVideoDir(); - string getDefaultMediaDir(int sourceType); + BaseSource * getSourceByPath(std::string & mediaPath); + std::string getDefaultImageDir(); + std::string getDefaultVideoDir(); + std::string getDefaultMediaDir(int sourceType); // Do things with FBO sources void addFboSource(FboSource & fboSource); // could be called also as register FBO source void addFboSource(FboSource * fboSource); - BaseSource * loadFboSource(string & fboSourceName); - void unloadFboSource(string & fboSourceName); + BaseSource * loadFboSource(std::string & fboSourceName); + void unloadFboSource(std::string & fboSourceName); // Custom events, add/remove - ofEvent onImageAdded; - ofEvent onImageRemoved; - ofEvent onVideoAdded; - ofEvent onVideoRemoved; - ofEvent onFboSourceAdded; - ofEvent onFboSourceRemoved; + ofEvent onImageAdded; + ofEvent onImageRemoved; + ofEvent onVideoAdded; + ofEvent onVideoRemoved; + ofEvent onFboSourceAdded; + ofEvent onFboSourceRemoved; // load/unload - ofEvent onImageLoaded; - ofEvent onImageUnloaded; - ofEvent onVideoLoaded; - ofEvent onVideoUnloaded; - ofEvent onFboSourceLoaded; - ofEvent onFboSourceUnloaded; + ofEvent onImageLoaded; + ofEvent onImageUnloaded; + ofEvent onVideoLoaded; + ofEvent onVideoUnloaded; + ofEvent onFboSourceLoaded; + ofEvent onFboSourceUnloaded; private: // Directory Watchers @@ -111,13 +111,13 @@ class MediaServer { DirectoryWatcher usb2ImageWatcher; DirectoryWatcher usb3ImageWatcher; - vector _tempImagePaths; - vector _tempVideoPaths; + std::vector _tempImagePaths; + std::vector _tempVideoPaths; - map loadedSources; + map loadedSources; // FBO source storage before they go to loadedSources - vector fboSources; // FBO source storage + std::vector fboSources; // FBO source storage }; } // namespace piMapper diff --git a/src/Sources/BaseSource.cpp b/src/Sources/BaseSource.cpp index 3ab1f92..507583e 100644 --- a/src/Sources/BaseSource.cpp +++ b/src/Sources/BaseSource.cpp @@ -4,7 +4,7 @@ namespace ofx { namespace piMapper { BaseSource::BaseSource(){ - //cout << "BaseSource" << endl; + //std::cout << "BaseSource" << std::endl; init(); } @@ -19,7 +19,7 @@ ofTexture * BaseSource::getTexture(){ return texture; } -string & BaseSource::getName(){ +std::string & BaseSource::getName(){ return name; } @@ -35,7 +35,7 @@ SourceType BaseSource::getType(){ return type; } -string & BaseSource::getPath(){ +std::string & BaseSource::getPath(){ return path; } @@ -49,11 +49,11 @@ void BaseSource::init(){ referenceCount = 1; // We have one instance on init } -void BaseSource::setNameFromPath(string & fullPath){ - vector pathParts; - //cout << "fullPath: " << fullPath << endl; +void BaseSource::setNameFromPath(std::string & fullPath){ + std::vector pathParts; + //std::cout << "fullPath: " << fullPath << std::endl; pathParts = ofSplitString(fullPath, "/"); // Maybe on win "/" is "\", have to test - //cout << "lastPathPart: " << pathParts[pathParts.size() - 1] << endl; + //std::cout << "lastPathPart: " << pathParts[pathParts.size() - 1] << std::endl; name = pathParts[pathParts.size() - 1]; } diff --git a/src/Sources/BaseSource.h b/src/Sources/BaseSource.h index c097359..84f8e42 100644 --- a/src/Sources/BaseSource.h +++ b/src/Sources/BaseSource.h @@ -13,11 +13,11 @@ class BaseSource { BaseSource(ofTexture * newTexture); // Only one clean way of passing the texture ~BaseSource(); ofTexture * getTexture(); - string & getName(); + std::string & getName(); bool isLoadable(); // Maybe the loading features shoud go to a derrived class bool isLoaded(); // as BaseSourceLoadable SourceType getType(); - string & getPath(); + std::string & getPath(); virtual void clear(){} virtual void togglePause(){} @@ -31,10 +31,10 @@ class BaseSource { void init(); protected: - void setNameFromPath(string & fullPath); + void setNameFromPath(std::string & fullPath); ofTexture * texture; - string name; - string path; // This is set only if loadable is true + std::string name; + std::string path; // This is set only if loadable is true bool loadable; // If the source can be loaded from disk like image and video bool loaded; // Is the source loaded? SourceType type; diff --git a/src/Sources/ImageSource.cpp b/src/Sources/ImageSource.cpp index 75ded43..08db4b6 100644 --- a/src/Sources/ImageSource.cpp +++ b/src/Sources/ImageSource.cpp @@ -11,7 +11,7 @@ ImageSource::ImageSource(){ ImageSource::~ImageSource(){} -void ImageSource::loadImage(string & filePath){ +void ImageSource::loadImage(std::string & filePath){ path = filePath; setNameFromPath(filePath); image = new ofImage(); diff --git a/src/Sources/ImageSource.h b/src/Sources/ImageSource.h index b22dba6..2d34270 100644 --- a/src/Sources/ImageSource.h +++ b/src/Sources/ImageSource.h @@ -10,8 +10,8 @@ class ImageSource : public BaseSource { public: ImageSource(); ~ImageSource(); - string & getPath(); - void loadImage(string & filePath); + std::string & getPath(); + void loadImage(std::string & filePath); void clear(); private: ofImage * image; diff --git a/src/Sources/OMXPlayerCache.cpp b/src/Sources/OMXPlayerCache.cpp index b051f9e..df98ac9 100644 --- a/src/Sources/OMXPlayerCache.cpp +++ b/src/Sources/OMXPlayerCache.cpp @@ -14,7 +14,7 @@ OMXPlayerCache * OMXPlayerCache::instance(){ return _instance; } -ofxOMXPlayer * OMXPlayerCache::load(string moviePath){ +ofxOMXPlayer * OMXPlayerCache::load(std::string moviePath){ if(_players.find(moviePath) == _players.end()){ ofxOMXPlayerSettings settings; settings.videoPath = moviePath; @@ -34,7 +34,7 @@ ofxOMXPlayer * OMXPlayerCache::load(string moviePath){ return _players[moviePath]; } -void OMXPlayerCache::unload(string moviePath){ +void OMXPlayerCache::unload(std::string moviePath){ if(_players.find(moviePath) != _players.end()){ _players[moviePath]->setPaused(true); } diff --git a/src/Sources/OMXPlayerCache.h b/src/Sources/OMXPlayerCache.h index ae427a0..26925a7 100644 --- a/src/Sources/OMXPlayerCache.h +++ b/src/Sources/OMXPlayerCache.h @@ -14,12 +14,12 @@ class OMXPlayerCache { public: static OMXPlayerCache * instance(); - ofxOMXPlayer * load(string moviePath); - void unload(string moviePath); + ofxOMXPlayer * load(std::string moviePath); + void unload(std::string moviePath); private: static OMXPlayerCache * _instance; - map _players; + map _players; }; diff --git a/src/Sources/SourceTypeHelper.h b/src/Sources/SourceTypeHelper.h index 6f6acae..b6e3b77 100644 --- a/src/Sources/SourceTypeHelper.h +++ b/src/Sources/SourceTypeHelper.h @@ -13,7 +13,7 @@ namespace piMapper { class SourceTypeHelper { public: - static string GetSourceTypeHelperName(SourceType sourceTypeEnum){ + static std::string GetSourceTypeHelperName(SourceType sourceTypeEnum){ if(sourceTypeEnum == SOURCE_TYPE_IMAGE){ return SOURCE_TYPE_NAME_IMAGE; }else if(sourceTypeEnum == SOURCE_TYPE_VIDEO){ @@ -23,14 +23,14 @@ class SourceTypeHelper { }else if(sourceTypeEnum == SOURCE_TYPE_FBO){ return SOURCE_TYPE_NAME_FBO; }else{ - stringstream ss; + std::stringstream ss; ss << "Invalid source type: " << sourceTypeEnum; ofLogFatalError("SourceTypeHelper") << ss.str(); exit(EXIT_FAILURE); } } - static SourceType GetSourceTypeHelperEnum(string sourceTypeName){ + static SourceType GetSourceTypeHelperEnum(std::string sourceTypeName){ if(sourceTypeName == SOURCE_TYPE_NAME_IMAGE){ return SOURCE_TYPE_IMAGE; }else if(sourceTypeName == SOURCE_TYPE_NAME_VIDEO){ @@ -40,7 +40,7 @@ class SourceTypeHelper { }else if(sourceTypeName == SOURCE_TYPE_NAME_FBO){ return SOURCE_TYPE_FBO; }else{ - stringstream ss; + std::stringstream ss; ss << "Invalid source type name: " << sourceTypeName; ofLogFatalError("SourceTypeHelper") << ss.str(); exit(EXIT_FAILURE); diff --git a/src/Sources/VideoSource.cpp b/src/Sources/VideoSource.cpp index 022c370..9c70e1e 100644 --- a/src/Sources/VideoSource.cpp +++ b/src/Sources/VideoSource.cpp @@ -18,7 +18,7 @@ VideoSource::VideoSource(){ #endif } -void VideoSource::loadVideo(string & filePath){ +void VideoSource::loadVideo(std::string & filePath){ path = filePath; setNameFromPath(filePath); #ifdef TARGET_RASPBERRY_PI diff --git a/src/Sources/VideoSource.h b/src/Sources/VideoSource.h index 18726c9..6fe8638 100644 --- a/src/Sources/VideoSource.h +++ b/src/Sources/VideoSource.h @@ -22,8 +22,8 @@ class VideoSource : public BaseSource { VideoSource(); - string & getPath(); - void loadVideo(string & path); + std::string & getPath(); + void loadVideo(std::string & path); void clear(); void togglePause(); diff --git a/src/Sources/magSlideShowSource.cpp b/src/Sources/magSlideShowSource.cpp index e3d6a74..6f8d9da 100644 --- a/src/Sources/magSlideShowSource.cpp +++ b/src/Sources/magSlideShowSource.cpp @@ -26,9 +26,10 @@ magSlideShowSource::magSlideShowSource() { } } -magSlideShowSource::~magSlideShowSource() { - directoryWatcher->endWatch(); - delete directoryWatcher; +magSlideShowSource::~magSlideShowSource(){ + if(directoryWatcher != 0){ + delete directoryWatcher; + } } bool magSlideShowSource::initialize(magSlideShowSource::Settings settings) { @@ -168,20 +169,18 @@ bool magSlideShowSource::createFromFolderContents(std::string path) { return false; } - auto sortedDir = dir.getSorted(); - auto files = sortedDir.getFiles(); + ofDirectory sortedDir = dir.getSorted(); + std::vector files = sortedDir.getFiles(); - if (files.size() < 1) - { + if (files.size() < 1){ ofLogError("magSlideShowSource::createFromFolderContents") << "Folder " << dir.getAbsolutePath() << " is empty"; return false; } ofImage tempImage; - for (auto &file : files) - { - if (tempImage.load(file)) - { + for(ofFile &file : files){ + if (tempImage.load(file.getFileName())){ + // make a new image slide auto slide = std::make_shared(); slide->setup(tempImage); @@ -189,9 +188,7 @@ bool magSlideShowSource::createFromFolderContents(std::string path) { slide->setTransitionDuration(static_cast(settings.transitionDuration*1000)); // if (settings.transitionName == "") addSlide(slide); - } - else - { + }else{ auto ext = ofToLower(file.getExtension()); static std::vector movieExtensions = { @@ -388,8 +385,7 @@ void magSlideShowSource::addSlide(std::shared_ptr slide) { } void magSlideShowSource::play() { - if (!isPlaying) - { + if (!isPlaying && slides.size()){ runningTime = 0; lastTime = ofGetElapsedTimeMillis(); isPlaying = true; diff --git a/src/Sources/magSlideShowSource.h b/src/Sources/magSlideShowSource.h index 60d541d..6573370 100644 --- a/src/Sources/magSlideShowSource.h +++ b/src/Sources/magSlideShowSource.h @@ -13,7 +13,6 @@ class magSlide; - class magSlideShowSource : public ofx::piMapper::FboSource { public: magSlideShowSource(); @@ -157,9 +156,9 @@ class magSlideShowSource : public ofx::piMapper::FboSource { int currentSlideIndex = 0; int direction = 1; int loopCount = 0; - ofx::piMapper::DirectoryWatcher* directoryWatcher; - void fileAddedListener(const void *sender); - void fileRemovedListener(const void *sender); + ofx::piMapper::DirectoryWatcher * directoryWatcher; + void fileAddedListener(const void * sender); + void fileRemovedListener(const void * sender); bool doInit; bool doPlayNextSlide = false; }; diff --git a/src/Sources/magSlideTransition.h b/src/Sources/magSlideTransition.h index ecb491b..8574f79 100644 --- a/src/Sources/magSlideTransition.h +++ b/src/Sources/magSlideTransition.h @@ -76,7 +76,7 @@ public: */ float getNormalizedTime(); - string const &getName() const + std::string const &getName() const { return name; } diff --git a/src/Sources/magSlideTransitionFactory.h b/src/Sources/magSlideTransitionFactory.h index cb998b0..1a3bd32 100644 --- a/src/Sources/magSlideTransitionFactory.h +++ b/src/Sources/magSlideTransitionFactory.h @@ -16,7 +16,7 @@ class magSlideTransitionFactory public: static magSlideTransitionFactory* instance(); - std::shared_ptr createTransition(string transitionName, + std::shared_ptr createTransition(std::string transitionName, std::shared_ptr slide, ofParameterGroup &group, u_int64_t duration); diff --git a/src/Surfaces/BaseSurface.cpp b/src/Surfaces/BaseSurface.cpp index c309abd..952742b 100644 --- a/src/Surfaces/BaseSurface.cpp +++ b/src/Surfaces/BaseSurface.cpp @@ -118,7 +118,7 @@ void BaseSurface::scaleTo(float scale){ _scale = scale; - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } diff --git a/src/Surfaces/BaseSurface.h b/src/Surfaces/BaseSurface.h index 5ab86e5..d8f36ae 100644 --- a/src/Surfaces/BaseSurface.h +++ b/src/Surfaces/BaseSurface.h @@ -20,16 +20,16 @@ class BaseSurface { virtual void setup() = 0; virtual void draw() = 0; virtual void setVertex(int index, Vec3 p) = 0; - virtual void setVertices(vector v) = 0; + virtual void setVertices(std::vector v) = 0; virtual void setTexCoord(int index, Vec2 t) = 0; - virtual void setTexCoords(vector t) = 0; + virtual void setTexCoords(std::vector t) = 0; virtual void moveBy(Vec3 v) = 0; virtual int getType() = 0; virtual bool hitTest(Vec2 p) = 0; virtual ofPolyline getHitArea() = 0; virtual ofPolyline getTextureHitArea() = 0; - virtual vector getVertices() = 0; - virtual vector getTexCoords() = 0; + virtual std::vector getVertices() = 0; + virtual std::vector getTexCoords() = 0; virtual BaseSurface * clone() = 0; void drawTexture(Vec3 position); @@ -46,7 +46,7 @@ class BaseSurface { ofMesh & getMesh(); ofRectangle & getBoundingBox(); - ofEvent> verticesChangedEvent; + ofEvent> verticesChangedEvent; ofEvent vertexChangedEvent; protected: diff --git a/src/Surfaces/CircleSurface.h b/src/Surfaces/CircleSurface.h index 5f23395..831f42f 100644 --- a/src/Surfaces/CircleSurface.h +++ b/src/Surfaces/CircleSurface.h @@ -38,17 +38,17 @@ class CircleSurface : public QuadSurface { bool updateMask; bool maskIsReady; -// string glESFragmentShader; -// string glESVertexShader; +// std::string glESFragmentShader; +// std::string glESVertexShader; // -// string gl2FragmentShader; -// string gl2VertexShader; +// std::string gl2FragmentShader; +// std::string gl2VertexShader; ofMesh maskMesh; // TODO: gl3 Shaders -// string gl3VertexShader; -// string gl3FragmentShader; +// std::string gl3VertexShader; +// std::string gl3FragmentShader; private: std::vector defaultTexCoords; diff --git a/src/Surfaces/GridWarpSurface.cpp b/src/Surfaces/GridWarpSurface.cpp index b48ad2c..5590915 100644 --- a/src/Surfaces/GridWarpSurface.cpp +++ b/src/Surfaces/GridWarpSurface.cpp @@ -36,7 +36,7 @@ void GridWarpSurface::moveBy(Vec3 v){ } setMoved(true); - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } @@ -80,7 +80,7 @@ bool GridWarpSurface::hitTest(Vec2 p){ pl.addVertex(mesh.getVertex(d)); pl.close(); - if(pl.inside(p.toOf())){ + if(pl.inside(p.x, p.y)){ return true; } } @@ -150,7 +150,7 @@ void GridWarpSurface::setVertex(int index, Vec3 vert){ ofNotifyEvent(vertexChangedEvent, index, this); } -void GridWarpSurface::setVertices(vector v){ +void GridWarpSurface::setVertices(std::vector v){ if(v.size() != mesh.getVertices().size()){ throw runtime_error("Wrong number of vertices"); } @@ -159,7 +159,7 @@ void GridWarpSurface::setVertices(vector v){ mesh.setVertex(i, v[i].toOf()); } - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } @@ -170,7 +170,7 @@ void GridWarpSurface::setTexCoord(int index, Vec2 t){ mesh.setTexCoord(index, t.toOf()); } -void GridWarpSurface::setTexCoords(vector t){ +void GridWarpSurface::setTexCoords(std::vector t){ if(t.size() != mesh.getVertices().size()){ throw runtime_error("Wrong number of texture coordinates"); } @@ -180,11 +180,11 @@ void GridWarpSurface::setTexCoords(vector t){ } -vector GridWarpSurface::getVertices(){ +std::vector GridWarpSurface::getVertices(){ return Vec3::fromOf(mesh.getVertices()); } -vector GridWarpSurface::getTexCoords(){ +std::vector GridWarpSurface::getTexCoords(){ return Vec2::fromOf(mesh.getTexCoords()); } @@ -200,9 +200,10 @@ void GridWarpSurface::createGridMesh(){ // Add vertices for each col and row for(int iy = 0; iy <= _gridRows; ++iy){ for(int ix = 0; ix <= _gridCols; ++ix){ - mesh.addVertex(Vec2( + mesh.addVertex(Vec3( margin + (vertexDistanceX * (float)ix), - margin + (vertexDistanceY * (float)iy)).toOf()); + margin + (vertexDistanceY * (float)iy), + 0.0f).toOf()); } } @@ -230,7 +231,7 @@ void GridWarpSurface::createGridMesh(){ } } - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } diff --git a/src/Surfaces/GridWarpSurface.h b/src/Surfaces/GridWarpSurface.h index 9f997f6..4a7baf8 100644 --- a/src/Surfaces/GridWarpSurface.h +++ b/src/Surfaces/GridWarpSurface.h @@ -30,11 +30,11 @@ class GridWarpSurface : public BaseSurface { ofPolyline getTextureHitArea(); void setVertex(int index, Vec3 p); - void setVertices(vector v); + void setVertices(std::vector v); void setTexCoord(int index, Vec2 t); - void setTexCoords(vector t); - vector getVertices(); - vector getTexCoords(); + void setTexCoords(std::vector t); + std::vector getVertices(); + std::vector getTexCoords(); void createGridMesh(); diff --git a/src/Surfaces/HexagonSurface.cpp b/src/Surfaces/HexagonSurface.cpp index 99df1d2..ee62775 100644 --- a/src/Surfaces/HexagonSurface.cpp +++ b/src/Surfaces/HexagonSurface.cpp @@ -11,7 +11,7 @@ void HexagonSurface::setup(){ // Create 6 + 1 points for the hexagon surface. - vector verts; + std::vector verts; verts.resize(7); // Start with the center. @@ -26,7 +26,7 @@ void HexagonSurface::setup(){ verts[6] = Vec3(0, (float)ofGetHeight() / 2.0f, 0.0f); // No create the texture coordinates. - vector coords; + std::vector coords; coords.resize(7); // Start with center. @@ -45,8 +45,8 @@ void HexagonSurface::setup(){ } void HexagonSurface::setup( - vector & verts, - vector & coords, + std::vector & verts, + std::vector & coords, BaseSource * newSource){ // Assign texture @@ -105,7 +105,7 @@ void HexagonSurface::draw(){ void HexagonSurface::setVertex(int index, Vec3 p){ if(index >= mesh.getVertices().size()){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; return; } @@ -113,7 +113,7 @@ void HexagonSurface::setVertex(int index, Vec3 p){ ofNotifyEvent(vertexChangedEvent, index, this); } -void HexagonSurface::setVertices(vector v){ +void HexagonSurface::setVertices(std::vector v){ if(v.size() != mesh.getVertices().size()){ throw runtime_error("Wrong number of vertices"); } @@ -122,21 +122,21 @@ void HexagonSurface::setVertices(vector v){ mesh.setVertex(i, v[i].toOf()); } - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } void HexagonSurface::setTexCoord(int index, Vec2 t){ if(index >= mesh.getTexCoords().size()){ ofLog() << "Texture coordinate with this index does not exist: " << index - << endl; + << std::endl; return; } mesh.setTexCoord(index, t.toOf()); } -void HexagonSurface::setTexCoords(vector t){ +void HexagonSurface::setTexCoords(std::vector t){ if(t.size() != mesh.getTexCoords().size()){ throw runtime_error("Wrong number of texture coordinates"); } @@ -152,7 +152,7 @@ void HexagonSurface::moveBy(Vec3 v){ } setMoved(true); - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } @@ -172,7 +172,7 @@ bool HexagonSurface::hitTest(Vec2 p){ Vec3 HexagonSurface::getVertex(int index){ if(index > 2){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; throw runtime_error("Vertex index out of bounds."); } @@ -217,11 +217,11 @@ ofPolyline HexagonSurface::getTextureHitArea(){ return line; } -vector HexagonSurface::getVertices(){ +std::vector HexagonSurface::getVertices(){ return Vec3::fromOf(mesh.getVertices()); } -vector HexagonSurface::getTexCoords(){ +std::vector HexagonSurface::getTexCoords(){ return Vec2::fromOf(mesh.getTexCoords()); } diff --git a/src/Surfaces/HexagonSurface.h b/src/Surfaces/HexagonSurface.h index 11277ec..9ba762c 100644 --- a/src/Surfaces/HexagonSurface.h +++ b/src/Surfaces/HexagonSurface.h @@ -17,14 +17,14 @@ class HexagonSurface : public BaseSurface { void setup(); void setup( - vector & verts, - vector & coords, + std::vector & verts, + std::vector & coords, BaseSource * newSource); void draw(); void setVertex(int index, Vec3 p); - void setVertices(vector v); + void setVertices(std::vector v); void setTexCoord(int index, Vec2 t); - void setTexCoords(vector t); + void setTexCoords(std::vector t); void moveBy(Vec3 v); int getType(); @@ -33,8 +33,8 @@ class HexagonSurface : public BaseSurface { Vec2 getTexCoord(int index); ofPolyline getHitArea(); ofPolyline getTextureHitArea(); - vector getVertices(); - vector getTexCoords(); + std::vector getVertices(); + std::vector getTexCoords(); BaseSurface * clone(); }; diff --git a/src/Surfaces/QuadSurface.cpp b/src/Surfaces/QuadSurface.cpp index 74c6c8a..3936d0c 100644 --- a/src/Surfaces/QuadSurface.cpp +++ b/src/Surfaces/QuadSurface.cpp @@ -9,7 +9,7 @@ QuadSurface::QuadSurface(){ } QuadSurface::~QuadSurface(){ - cout << "QuadSurface destructor." << endl; + std::cout << "QuadSurface destructor." << std::endl; } void QuadSurface::setup(){ @@ -112,7 +112,7 @@ void QuadSurface::draw(){ void QuadSurface::setVertex(int index, Vec3 p){ if(index > 3){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; return; } @@ -120,7 +120,7 @@ void QuadSurface::setVertex(int index, Vec3 p){ ofNotifyEvent(vertexChangedEvent, index, this); } -void QuadSurface::setVertices(vector v){ +void QuadSurface::setVertices(std::vector v){ if(v.size() != 4){ throw runtime_error("Wrong number of vertices"); } @@ -129,21 +129,21 @@ void QuadSurface::setVertices(vector v){ mesh.setVertex(i, v[i].toOf()); } - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } void QuadSurface::setTexCoord(int index, Vec2 t){ if(index > 3){ ofLog() << "Texture coordinate with this index does not exist: " << index - << endl; + << std::endl; return; } mesh.setTexCoord(index, t.toOf()); } -void QuadSurface::setTexCoords(vector t){ +void QuadSurface::setTexCoords(std::vector t){ if(t.size() != 4){ throw runtime_error("Wrong number of vertices"); } @@ -158,7 +158,7 @@ void QuadSurface::moveBy(Vec3 v){ } setMoved(true); - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } @@ -178,7 +178,7 @@ bool QuadSurface::hitTest(Vec2 p){ Vec3 QuadSurface::getVertex(int index){ if(index > 3){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; throw runtime_error("Vertex index out of bounds."); } @@ -223,11 +223,11 @@ ofPolyline QuadSurface::getTextureHitArea(){ return line; } -vector QuadSurface::getVertices(){ +std::vector QuadSurface::getVertices(){ return Vec3::fromOf(mesh.getVertices()); } -vector QuadSurface::getTexCoords(){ +std::vector QuadSurface::getTexCoords(){ return Vec2::fromOf(mesh.getTexCoords()); } diff --git a/src/Surfaces/QuadSurface.h b/src/Surfaces/QuadSurface.h index 8a48b56..738dd8c 100644 --- a/src/Surfaces/QuadSurface.h +++ b/src/Surfaces/QuadSurface.h @@ -22,9 +22,9 @@ class QuadSurface : public BaseSurface { BaseSource * newSource); void draw(); void setVertex(int index, Vec3 p); - void setVertices(vector v); + void setVertices(std::vector v); void setTexCoord(int index, Vec2 t); - void setTexCoords(vector t); + void setTexCoords(std::vector t); void moveBy(Vec3 v); int getType(); @@ -33,8 +33,8 @@ class QuadSurface : public BaseSurface { Vec2 getTexCoord(int index); ofPolyline getHitArea(); ofPolyline getTextureHitArea(); - vector getVertices(); - vector getTexCoords(); + std::vector getVertices(); + std::vector getTexCoords(); void setPerspectiveWarping(bool b); bool getPerspectiveWarping(); diff --git a/src/Surfaces/SurfaceFactory.cpp b/src/Surfaces/SurfaceFactory.cpp index c6d02ed..847f13c 100644 --- a/src/Surfaces/SurfaceFactory.cpp +++ b/src/Surfaces/SurfaceFactory.cpp @@ -29,13 +29,13 @@ BaseSurface * SurfaceFactory::createSurface(SurfaceType type){ } TriangleSurface * SurfaceFactory::createTriangleSurface(){ - vector vertices; + std::vector vertices; float margin = 50.0f; vertices.push_back(Vec3((float)ofGetWidth() / 2.0f, margin, 0.0f)); vertices.push_back(Vec3((float)ofGetWidth() - margin, (float)ofGetHeight() - margin, 0.0f)); vertices.push_back(Vec3(margin, (float)ofGetHeight() - margin, 0.0f)); - vector texCoords; + std::vector texCoords; texCoords.push_back(Vec2(0.5f, 0.0f)); texCoords.push_back(Vec2(1.0f, 1.0f)); texCoords.push_back(Vec2(0.0f, 1.0f)); @@ -51,14 +51,14 @@ TriangleSurface * SurfaceFactory::createTriangleSurface(){ } QuadSurface * SurfaceFactory::createQuadSurface(){ - vector vertices; + std::vector vertices; float margin = 50.0f; vertices.push_back(Vec3(margin, margin, 0.0f)); vertices.push_back(Vec3((float)ofGetWidth() - margin, margin, 0.0f)); vertices.push_back(Vec3((float)ofGetWidth() - margin, (float)ofGetHeight() - margin, 0.0f)); vertices.push_back(Vec3(margin, (float)ofGetHeight() - margin, 0.0f)); - vector texCoords; + std::vector texCoords; texCoords.push_back(Vec2(Vec2(0.0f, 0.0f))); texCoords.push_back(Vec2(Vec2(1.0f, 0.0f))); texCoords.push_back(Vec2(Vec2(1.0f, 1.0f))); diff --git a/src/Surfaces/SurfaceManager.cpp b/src/Surfaces/SurfaceManager.cpp index e991efb..dda8eca 100644 --- a/src/Surfaces/SurfaceManager.cpp +++ b/src/Surfaces/SurfaceManager.cpp @@ -111,7 +111,7 @@ void SurfaceManager::clearPresets(){ } // TODO: Do serious adjustment here. We need to save all presets. Not just the active one. -void SurfaceManager::saveXmlSettings(string fileName){ +void SurfaceManager::saveXmlSettings(std::string fileName){ if(_presets.size() <= 0){ ofLogWarning( "SurfaceManager::saveXmlSettings", @@ -128,7 +128,7 @@ void SurfaceManager::saveXmlSettings(string fileName){ } // TODO: We need to load all presets. Not just the active one. -bool SurfaceManager::loadXmlSettings(string fileName){ +bool SurfaceManager::loadXmlSettings(std::string fileName){ if(mediaServer == 0){ ofLogFatalError("SurfaceManager") << "Media server not set"; exit(EXIT_FAILURE); @@ -292,7 +292,7 @@ void SurfaceManager::selectVertex(int i){ } if(i > selectedSurface->getVertices().size() - 1){ - ofLogError("SurfaceManager::selectVertex") << "index (" << i << ") out of bounds" << endl; + ofLogError("SurfaceManager::selectVertex") << "index (" << i << ") out of bounds" << std::endl; int prevVertIndex = _selectedVertexIndex; ofNotifyEvent(vertexUnselectedEvent, prevVertIndex, this); _selectedVertexIndex = -1; @@ -393,7 +393,7 @@ void SurfaceManager::onVertexChanged(int & i){ ofNotifyEvent(vertexChangedEvent, i, this); } -void SurfaceManager::onVerticesChanged(vector & vertices){ +void SurfaceManager::onVerticesChanged(std::vector & vertices){ ofNotifyEvent(verticesChangedEvent, vertices, this); } diff --git a/src/Surfaces/SurfaceManager.h b/src/Surfaces/SurfaceManager.h index b33cd07..d798037 100644 --- a/src/Surfaces/SurfaceManager.h +++ b/src/Surfaces/SurfaceManager.h @@ -33,11 +33,11 @@ class SurfaceManager { void removeSurface(int i); void deleteSurface(BaseSurface * surface); void deselectSurface(); - void saveXmlSettings(string fileName); + void saveXmlSettings(std::string fileName); void setMediaServer(MediaServer * newMediaServer); void clearPresets(); - bool loadXmlSettings(string fileName); + bool loadXmlSettings(std::string fileName); BaseSurface * getSurface(int index); BaseSurface * selectSurface(int index); @@ -61,13 +61,13 @@ class SurfaceManager { unsigned int getNumPresets(); ofEvent vertexChangedEvent; - ofEvent > verticesChangedEvent; + ofEvent > verticesChangedEvent; ofEvent surfaceSelectedEvent; ofEvent vertexSelectedEvent; ofEvent vertexUnselectedEvent; void onVertexChanged(int & i); - void onVerticesChanged(vector & vertices); + void onVerticesChanged(std::vector & vertices); SurfaceStack * getActivePreset(); SurfaceStack * createPreset(); @@ -86,7 +86,7 @@ class SurfaceManager { int _selectedVertexIndex; int _activePresetIndex; - vector _presets; + std::vector _presets; }; diff --git a/src/Surfaces/SurfaceStack.cpp b/src/Surfaces/SurfaceStack.cpp index 22605be..c11a7c9 100644 --- a/src/Surfaces/SurfaceStack.cpp +++ b/src/Surfaces/SurfaceStack.cpp @@ -65,7 +65,7 @@ BaseSurface * SurfaceStack::back(){ return _surfaces.back(); } -void SurfaceStack::onVerticesChanged(vector & vertices){ +void SurfaceStack::onVerticesChanged(std::vector & vertices){ ofNotifyEvent(verticesChangedEvent, vertices, this); } diff --git a/src/Surfaces/SurfaceStack.h b/src/Surfaces/SurfaceStack.h index 7607167..98d19b6 100644 --- a/src/Surfaces/SurfaceStack.h +++ b/src/Surfaces/SurfaceStack.h @@ -21,18 +21,18 @@ class SurfaceStack { BaseSurface * at(int i); BaseSurface * back(); - ofEvent > verticesChangedEvent; + ofEvent > verticesChangedEvent; ofEvent vertexChangedEvent; - void onVerticesChanged(vector & vertices); + void onVerticesChanged(std::vector & vertices); void onVertexChanged(int & i); - vector & getSurfaces(){ return _surfaces; }; + std::vector & getSurfaces(){ return _surfaces; }; SurfaceStack * clone(); private: - vector _surfaces; + std::vector _surfaces; }; } // namespace piMapper diff --git a/src/Surfaces/TriangleSurface.cpp b/src/Surfaces/TriangleSurface.cpp index bf1c0a1..3296e45 100644 --- a/src/Surfaces/TriangleSurface.cpp +++ b/src/Surfaces/TriangleSurface.cpp @@ -64,7 +64,7 @@ void TriangleSurface::draw(){ void TriangleSurface::setVertex(int index, Vec3 p){ if(index > 2){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; return; } @@ -72,7 +72,7 @@ void TriangleSurface::setVertex(int index, Vec3 p){ ofNotifyEvent(vertexChangedEvent, index, this); } -void TriangleSurface::setVertices(vector v){ +void TriangleSurface::setVertices(std::vector v){ if(v.size() != 3){ throw runtime_error("Wrong number of vertices"); } @@ -81,21 +81,21 @@ void TriangleSurface::setVertices(vector v){ mesh.setVertex(i, v[i].toOf()); } - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } void TriangleSurface::setTexCoord(int index, Vec2 t){ if(index > 2){ ofLog() << "Texture coordinate with this index does not exist: " << index - << endl; + << std::endl; return; } mesh.setTexCoord(index, t.toOf()); } -void TriangleSurface::setTexCoords(vector t){ +void TriangleSurface::setTexCoords(std::vector t){ if(t.size() != 3){ throw runtime_error("Wrong number of texture coordinates"); } @@ -111,7 +111,7 @@ void TriangleSurface::moveBy(Vec3 v){ } setMoved(true); - vector vertices = Vec3::fromOf(mesh.getVertices()); + std::vector vertices = Vec3::fromOf(mesh.getVertices()); ofNotifyEvent(verticesChangedEvent, vertices, this); } @@ -131,7 +131,7 @@ bool TriangleSurface::hitTest(Vec2 p){ Vec2 TriangleSurface::getVertex(int index){ if(index > 2){ - ofLog() << "Vertex with this index does not exist: " << index << endl; + ofLog() << "Vertex with this index does not exist: " << index << std::endl; throw runtime_error("Vertex index out of bounds."); } @@ -142,7 +142,7 @@ Vec2 TriangleSurface::getVertex(int index){ Vec2 TriangleSurface::getTexCoord(int index){ if(index > 2){ - ofLog() << "Texture coordinate with this index does not exist: " << index << endl; + ofLog() << "Texture coordinate with this index does not exist: " << index << std::endl; throw runtime_error("Texture coordinate index out of bounds."); } @@ -177,11 +177,11 @@ ofPolyline TriangleSurface::getTextureHitArea(){ return line; } -vector TriangleSurface::getVertices(){ +std::vector TriangleSurface::getVertices(){ return Vec3::fromOf(mesh.getVertices()); } -vector TriangleSurface::getTexCoords(){ +std::vector TriangleSurface::getTexCoords(){ return Vec2::fromOf(mesh.getTexCoords()); } diff --git a/src/Surfaces/TriangleSurface.h b/src/Surfaces/TriangleSurface.h index 9546e08..091688a 100644 --- a/src/Surfaces/TriangleSurface.h +++ b/src/Surfaces/TriangleSurface.h @@ -20,9 +20,9 @@ class TriangleSurface : public BaseSurface { BaseSource * newSource); void draw(); void setVertex(int index, Vec3 p); - void setVertices(vector v); + void setVertices(std::vector v); void setTexCoord(int index, Vec2 t); - void setTexCoords(vector t); + void setTexCoords(std::vector t); void moveBy(Vec3 v); int getType(); @@ -31,8 +31,8 @@ class TriangleSurface : public BaseSurface { Vec2 getTexCoord(int index); ofPolyline getHitArea(); ofPolyline getTextureHitArea(); - vector getVertices(); - vector getTexCoords(); + std::vector getVertices(); + std::vector getTexCoords(); BaseSurface * clone(); }; diff --git a/src/Types/Vec2.cpp b/src/Types/Vec2.cpp index 35fb3da..a812fcf 100644 --- a/src/Types/Vec2.cpp +++ b/src/Types/Vec2.cpp @@ -1,5 +1,9 @@ #include "Vec2.h" +#if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR > 9 + #include "glm/geometric.hpp" +#endif + namespace ofx { namespace piMapper { @@ -22,16 +26,16 @@ Vec2::Vec2(float ix, float iy){ return ofVec2f(x, y); } - vector Vec2::toOf(vector & src){ - vector retVal; + std::vector Vec2::toOf(std::vector & src){ + std::vector retVal; for(auto itm : src){ retVal.push_back(itm.toOf()); } return retVal; } - vector Vec2::fromOf(vector & src){ - vector retVal; + std::vector Vec2::fromOf(std::vector & src){ + std::vector retVal; for(auto itm : src){ retVal.push_back(Vec2(itm)); } @@ -44,7 +48,37 @@ Vec2::Vec2(float ix, float iy){ return v1.distance(v2); } #else - // TODO: The same for glm::vec2 + Vec2::Vec2(glm::vec2 & src){ + x = src.x; + y = src.y; + } + + glm::vec2 Vec2::toOf(){ + return glm::vec2(x, y); + } + + std::vector Vec2::toOf(std::vector & src){ + std::vector retVal; + for(auto itm : src){ + retVal.push_back(itm.toOf()); + } + return retVal; + } + + std::vector Vec2::fromOf(std::vector & src){ + std::vector retVal; + for(auto itm : src){ + retVal.push_back(Vec2(itm)); + } + return retVal; + } + + float Vec2::distance(const Vec2 & other){ + glm::vec2 v1(x, y); + glm::vec2 v2(other.x, other.y); + + return glm::distance(v1, v2); + } #endif void Vec2::operator=(const Vec2 & other){ diff --git a/src/Types/Vec2.h b/src/Types/Vec2.h index e0414f6..80a86fe 100644 --- a/src/Types/Vec2.h +++ b/src/Types/Vec2.h @@ -1,9 +1,11 @@ #pragma once +#include + #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 #include "ofVec2f.h" #else - // TODO: include glm + #include "glm/vec2.hpp" #endif namespace ofx { @@ -18,10 +20,13 @@ public: #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 Vec2(ofVec2f & src); ofVec2f toOf(); - static vector toOf(vector & src); - static vector fromOf(vector & src); + static std::vector toOf(std::vector & src); + static std::vector fromOf(std::vector & src); #else - // TODO: glm + Vec2(glm::vec2 & src); + glm::vec2 toOf(); + static std::vector toOf(std::vector & src); + static std::vector fromOf(std::vector & src); #endif float distance(const Vec2 & other); diff --git a/src/Types/Vec3.cpp b/src/Types/Vec3.cpp index e3304b7..dda8c91 100644 --- a/src/Types/Vec3.cpp +++ b/src/Types/Vec3.cpp @@ -24,23 +24,47 @@ Vec3::Vec3(float ix, float iy, float iz){ return ofVec3f(x, y, z); } - vector Vec3::toOf(vector & src){ - vector retVal; + std::vector Vec3::toOf(std::vector & src){ + std::vector retVal; for(auto itm : src){ retVal.push_back(itm.toOf()); } return retVal; } - vector Vec3::fromOf(vector & src){ - vector retVal; + std::vector Vec3::fromOf(std::vector & src){ + std::vector retVal; for(auto itm : src){ retVal.push_back(Vec3(itm)); } return retVal; } #else - // TODO: Vec3::Vec3(glm::vec3 & src){...} + Vec3::Vec3(glm::vec3 & src){ + x = src.x; + y = src.y; + z = src.z; + } + + glm::vec3 Vec3::toOf(){ + return ofVec3f(x, y, z); + } + + std::vector Vec3::toOf(std::vector & src){ + std::vector retVal; + for(auto itm : src){ + retVal.push_back(itm.toOf()); + } + return retVal; + } + + std::vector Vec3::fromOf(std::vector & src){ + std::vector retVal; + for(auto itm : src){ + retVal.push_back(Vec3(itm)); + } + return retVal; + } #endif void Vec3::operator=(const Vec3 & other){ diff --git a/src/Types/Vec3.h b/src/Types/Vec3.h index c9df2d7..edce17f 100644 --- a/src/Types/Vec3.h +++ b/src/Types/Vec3.h @@ -1,9 +1,11 @@ #pragma once +#include + #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 #include "ofVec3f.h" #else - // TODO: include glm + #include "glm/vec3.hpp" #endif namespace ofx { @@ -18,10 +20,13 @@ public: #if OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR <= 9 Vec3(ofVec3f & src); ofVec3f toOf(); - static vector toOf(vector & src); - static vector fromOf(vector & src); + static std::vector toOf(std::vector & src); + static std::vector fromOf(std::vector & src); #else - // TODO: Vec3(glm::vec3 & src); + Vec3(glm::vec3 & src); + glm::vec3 toOf(); + static std::vector toOf(std::vector & src); + static std::vector fromOf(std::vector & src); #endif void operator=(const Vec3 & other); diff --git a/src/UserInterface/RadioList.cpp b/src/UserInterface/RadioList.cpp index abc3c57..3b95a56 100644 --- a/src/UserInterface/RadioList.cpp +++ b/src/UserInterface/RadioList.cpp @@ -8,12 +8,12 @@ RadioList::RadioList(){ storedSelectedItem = 0; } -RadioList::RadioList(vector & labels, vector & values){ +RadioList::RadioList(std::vector & labels, std::vector & values){ RadioList(); setup(labels, values); } -RadioList::RadioList(string title, vector & labels, vector & values){ +RadioList::RadioList(std::string title, std::vector & labels, std::vector & values){ RadioList(); setup(title, labels, values); } @@ -22,7 +22,7 @@ RadioList::~RadioList(){ clear(); } -void RadioList::setup(vector & labels, vector & values){ +void RadioList::setup(std::vector & labels, std::vector & values){ // Copy incomming labels for later use storedLabels = labels; @@ -42,7 +42,7 @@ void RadioList::setup(vector & labels, vector & values){ } } -void RadioList::setup(string title, vector & labels, vector & values){ +void RadioList::setup(std::string title, std::vector & labels, std::vector & values){ // Store title for later use storedTitle = title; @@ -54,7 +54,7 @@ void RadioList::draw(){ guiGroup.draw(); } -void RadioList::setTitle(string title){ +void RadioList::setTitle(std::string title){ storedTitle = title; guiGroup.setName(title); } @@ -78,14 +78,14 @@ void RadioList::selectItem(int index){ toggle->removeListener(this, &RadioList::onToggleClicked); *toggle = true; // Select the specific radio button toggle->addListener(this, &RadioList::onToggleClicked); - //string name = toggle->getName(); + //std::string name = toggle->getName(); // Throw event with value that is image path instead of name - string value = storedValues[index]; + std::string value = storedValues[index]; ofNotifyEvent(onRadioSelected, value, this); storedSelectedItem = index; } -bool RadioList::selectItemByValue(string itemValue){ +bool RadioList::selectItemByValue(std::string itemValue){ if(itemValue == ""){ ofLogNotice("RadioList") << "Item value empty"; return false; @@ -123,7 +123,7 @@ void RadioList::enable(){ *toggle = true; toggle->addListener(this, &RadioList::onToggleClicked); - cout << "num items after enable: " << guiGroup.getNumControls() << endl; + std::cout << "num items after enable: " << guiGroup.getNumControls() << std::endl; } void RadioList::disable(){ @@ -164,11 +164,11 @@ float RadioList::getHeight(){ return guiGroup.getHeight(); } -string RadioList::getTitle(){ +std::string RadioList::getTitle(){ return guiGroup.getName(); } -string RadioList::getItemName(int index){ +std::string RadioList::getItemName(int index){ if(index >= guiGroup.getNumControls()){ return ""; } diff --git a/src/UserInterface/RadioList.h b/src/UserInterface/RadioList.h index 5e67a4f..9ce66c4 100644 --- a/src/UserInterface/RadioList.h +++ b/src/UserInterface/RadioList.h @@ -11,18 +11,18 @@ namespace piMapper { class RadioList { public: RadioList(); - RadioList(vector & labels, vector & values); - RadioList(string title, vector & labels, vector & values); + RadioList(std::vector & labels, std::vector & values); + RadioList(std::string title, std::vector & labels, std::vector & values); ~RadioList(); - void setup(vector & labels, vector & values); - void setup(string title, vector & labels, vector & values); + void setup(std::vector & labels, std::vector & values); + void setup(std::string title, std::vector & labels, std::vector & values); void draw(); - void setTitle(string title); + void setTitle(std::string title); void setPosition(ofPoint p); void setPosition(float x, float y); void selectItem(int index); - bool selectItemByValue(string itemValue); + bool selectItemByValue(std::string itemValue); void enable(); void disable(); void clear(); @@ -30,21 +30,21 @@ class RadioList { ofPoint getPosition(); float getWidth(); float getHeight(); - string getTitle(); - string getItemName(int index); + std::string getTitle(); + std::string getItemName(int index); int size(); // This event notifies about a toggle being selected and passes it's name to // the listeners. // Use ofAddListener(RadioListInstance.radioSelectedEvent, listenerClassPtr, // &listenerClass::listenerMethod) - // to listen to this. Listner method void listenerMethod(string & radioName) - ofEvent onRadioSelected; + // to listen to this. Listner method void listenerMethod(std::string & radioName) + ofEvent onRadioSelected; private: - vector storedLabels; - vector storedValues; - string storedTitle; + std::vector storedLabels; + std::vector storedValues; + std::string storedTitle; ofxGuiGroup guiGroup; int storedSelectedItem; diff --git a/src/ofxPiMapper.cpp b/src/ofxPiMapper.cpp index dfe47dc..c41eeac 100644 --- a/src/ofxPiMapper.cpp +++ b/src/ofxPiMapper.cpp @@ -156,7 +156,7 @@ void ofxPiMapper::createSurface(ofx::piMapper::SurfaceType type){ } void ofxPiMapper::eraseSurface(int i){ - cout << "numSurfaces: " << getNumSurfaces() << ", i: " << i << endl; + std::cout << "numSurfaces: " << getNumSurfaces() << ", i: " << i << std::endl; if(getNumSurfaces() > 0 && i < getNumSurfaces()){ _application.eraseSurface(i); } @@ -166,7 +166,7 @@ void ofxPiMapper::setNextSource(){ _application.setNextSource(); } -void ofxPiMapper::setFboSource(string sourceId){ +void ofxPiMapper::setFboSource(std::string sourceId){ _application.setFboSource(sourceId); } @@ -182,7 +182,7 @@ void ofxPiMapper::saveProject(){ _application.saveProject(); } -bool ofxPiMapper::loadProject(string filename){ +bool ofxPiMapper::loadProject(std::string filename){ return _application.loadXmlSettings(filename); } @@ -202,7 +202,7 @@ int ofxPiMapper::getSelectedSurface(){ return _application.getSurfaceManager()->getSelectedSurfaceIndex(); } -void ofxPiMapper::setInfoText(string text){ +void ofxPiMapper::setInfoText(std::string text){ _application.setInfoText(text); } diff --git a/src/ofxPiMapper.h b/src/ofxPiMapper.h index 1b036d1..f8e72eb 100644 --- a/src/ofxPiMapper.h +++ b/src/ofxPiMapper.h @@ -28,7 +28,7 @@ class ofxPiMapper { void registerFboSource(ofx::piMapper::FboSource * fboSource); // Application - void setInfoText(string text); + void setInfoText(std::string text); void toggleInfo(); void undo(); void deselect(); @@ -39,7 +39,7 @@ class ofxPiMapper { // Project void saveProject(); - bool loadProject(string filename); + bool loadProject(std::string filename); // Presets unsigned int getNumPresets(); @@ -74,7 +74,7 @@ class ofxPiMapper { // Sources, selected surface void setNextSource(); - void setFboSource(string sourceId); + void setFboSource(std::string sourceId); // System commands void reboot();