diff --git a/examples/3d/quaternionArcballExample/src/ofApp.cpp b/examples/3d/quaternionArcballExample/src/ofApp.cpp index 9d108f6c067..ef67dd1097c 100644 --- a/examples/3d/quaternionArcballExample/src/ofApp.cpp +++ b/examples/3d/quaternionArcballExample/src/ofApp.cpp @@ -72,7 +72,7 @@ void ofApp::draw(){ float redValueFromXspeed = ofMap( fabs(xspeed), 1, 15, 100, 255, true ); float greenValueFromYspeed = ofMap( fabs(yspeed), 1, 15, 100, 255, true ); - ofSetColor( redValueFromXspeed, greenValueFromYspeed, MIN(redValueFromXspeed, greenValueFromYspeed) ); + ofSetColor( redValueFromXspeed, greenValueFromYspeed, std::min(redValueFromXspeed, greenValueFromYspeed) ); ofDrawSphere(0, -newSize, 0, 10.0 ); ofDrawSphere(0, newSize, 0, 10.0 ); ofDrawSphere(newSize, 0, 0, 10.0 ); diff --git a/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp b/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp index 03e60ea7ca3..2543e04f099 100644 --- a/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp +++ b/examples/computer_vision/opencvOpticalFlowExample/src/ofApp.cpp @@ -95,7 +95,7 @@ void ofApp::update(){ // store as floats flowMat = cv::Mat(scaledHeight, scaledWidth, CV_32FC2); - ofSetWindowShape(MIN(sourceWidth, 1920), MIN(sourceHeight, 1200)); + ofSetWindowShape(std::min(sourceWidth, 1920), std::min(sourceHeight, 1200)); // clear the previous vectors spinCubes.clear(); diff --git a/examples/gl/fboHighResOutputExample/src/ofApp.cpp b/examples/gl/fboHighResOutputExample/src/ofApp.cpp index 132061bef32..ce20b3b482e 100644 --- a/examples/gl/fboHighResOutputExample/src/ofApp.cpp +++ b/examples/gl/fboHighResOutputExample/src/ofApp.cpp @@ -10,8 +10,8 @@ void ofApp::setup(){ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize); // take the smaller size - int fboWidth = MIN(8192,maxSize); - int fboHeight = MIN(8192,maxSize); + int fboWidth = std::min(8192,maxSize); + int fboHeight = std::min(8192,maxSize); //allocate our fbo with 3 color channels and 4x multisample #ifdef TARGET_EMSCRIPTEN fboOutput.allocate(fboWidth, fboHeight, GL_RGB); diff --git a/examples/input_output/xmlSettingsExample/src/ofApp.cpp b/examples/input_output/xmlSettingsExample/src/ofApp.cpp index 60c501282bf..63abb3f1245 100644 --- a/examples/input_output/xmlSettingsExample/src/ofApp.cpp +++ b/examples/input_output/xmlSettingsExample/src/ofApp.cpp @@ -69,7 +69,7 @@ void ofApp::setup(){ //we have only allocated a certan amount of space for our array //so we don't want to read more than that amount of points - int totalToRead = MIN(numPtTags, NUM_PTS); + int totalToRead = std::min(numPtTags, NUM_PTS); for(int i = 0; i < totalToRead; i++){ //the last argument of getValue can be used to specify diff --git a/examples/ios/xmlSettingsExample/src/ofApp.mm b/examples/ios/xmlSettingsExample/src/ofApp.mm index 38144769a3a..47e1edb8a4f 100644 --- a/examples/ios/xmlSettingsExample/src/ofApp.mm +++ b/examples/ios/xmlSettingsExample/src/ofApp.mm @@ -15,8 +15,8 @@ //we load our settings file //initially we do this from the data/ folder //but when we save we are saving to the documents folder which is the only place we have write access to - //thats why we check if the file exists in the documents folder. - + //thats why we check if the file exists in the documents folder. + if( XML.loadFile(ofxiOSGetDocumentsDirectory() + "mySettings.xml") ){ message = "mySettings.xml loaded from documents folder!"; }else if( XML.loadFile("mySettings.xml") ){ @@ -24,7 +24,7 @@ }else{ message = "unable to load mySettings.xml check data/ folder"; } - + //read the colors from XML //if the settings file doesn't exist we assigns default values (170, 190, 240) red = XML.getValue("BACKGROUND:COLOR:RED", 170); @@ -74,7 +74,7 @@ //we have only allocated a certan amount of space for our array //so we don't want to read more than that amount of points - int totalToRead = MIN(numPtTags, NUM_PTS); + int totalToRead = std::min(numPtTags, NUM_PTS); for(int i = 0; i < totalToRead; i++){ //the last argument of getValue can be used to specify @@ -110,11 +110,11 @@ string drawString = "How the data is stored:\n\n"; if(xmlStructure.size() > 0){ ofEnableAlphaBlending(); - ofSetColor(255-red, 255-green, 255-blue, 180); + ofSetColor(255-red, 255-green, 255-blue, 180); drawString += xmlStructure+""; TTF.drawString(drawString, 5, 60); } - + //--------- //Lets draw the stroke as a continous line ofSetHexColor(0x222222); @@ -146,7 +146,7 @@ //-------------------------------------------------------------- void ofApp::exit(){ - + } //-------------------------------------------------------------- @@ -226,7 +226,7 @@ dragPts[pointCount].set(touch.x, touch.y); pointCount++; } - + } } @@ -254,21 +254,20 @@ //-------------------------------------------------------------- void ofApp::lostFocus(){ - + } //-------------------------------------------------------------- void ofApp::gotFocus(){ - + } //-------------------------------------------------------------- void ofApp::gotMemoryWarning(){ - + } //-------------------------------------------------------------- void ofApp::deviceOrientationChanged(int newOrientation){ - -} +} diff --git a/examples/shader/07_fboAlphaMaskExample/src/ofApp.cpp b/examples/shader/07_fboAlphaMaskExample/src/ofApp.cpp index 50219968ce5..04abbf53703 100644 --- a/examples/shader/07_fboAlphaMaskExample/src/ofApp.cpp +++ b/examples/shader/07_fboAlphaMaskExample/src/ofApp.cpp @@ -8,24 +8,24 @@ void ofApp::setup(){ }else{ shader.load("shadersGL2/shader"); } - + brushImage.load("brush.png"); // change the image to draw from the center // the default is from top left brushImage.setAnchorPercent(0.5f, 0.5f); - + textures.resize(5); for( int i = 0; i < textures.size(); i++ ){ ofLoadImage(textures[i], "tex"+ofToString(i,0)+".jpg"); } - + bBrushDown = false; - + } //-------------------------------------------------------------- void ofApp::update(){ - + // check to see if we need a new fbo size // if the window size changes or the fbo is not allocated, we can catch it here and reallocate if( !maskFbo.isAllocated() || maskFbo.getWidth() != ofGetWidth() || maskFbo.getHeight() != ofGetHeight() ){ @@ -36,7 +36,7 @@ void ofApp::update(){ maskFbo.begin(); ofClear(0,0,0,255); maskFbo.end(); - + drawMesh = ofMesh::plane(maskFbo.getWidth(), maskFbo.getHeight() ); // the plane has tex coords from 0 - 1, but we need tex coords from 0 -> maskFbo.getWidth() auto& texCoords = drawMesh.getTexCoords(); @@ -45,11 +45,11 @@ void ofApp::update(){ for( auto& tc : texCoords ){ tc = maskFbo.getTexture().getCoordFromPercent(tc.x, (1.0-tc.y)); } - + // lets reload the font at a size in relation to width or height ofTrueTypeFont tf; - tf.load("Batang.ttf", MIN(maskFbo.getWidth(), maskFbo.getHeight()) / 2, true, true, true); - + tf.load("Batang.ttf", std::min(maskFbo.getWidth(), maskFbo.getHeight()) / 2, true, true, true); + oLine.clear(); // pull out the polylines of the O character for later use // getCharacterAsPoints returns an ofPath @@ -60,7 +60,7 @@ void ofApp::update(){ for( auto op : opolys ){ oLine.addVertices( op.getVertices() ); } - + fLine.clear(); // pull out the polylines of the F character for later use opath = tf.getCharacterAsPoints('F', true, false); @@ -75,7 +75,7 @@ void ofApp::update(){ void ofApp::draw(){ ofSetColor(255); - + //---------------------------------------------------------- // draw the brush into the fbo with the position based on the polylines derived from the font maskFbo.begin(); @@ -87,21 +87,21 @@ void ofApp::draw(){ // store the elapsed time in a variable for later use float elapsedTime = ofGetElapsedTimef(); float deltaTime = ofClamp( ofGetLastFrameTime(), 1.f / 1000.0, 1.f / 5.0f ); - + float mouseXPercent = ofMap( ofGetMouseX(), 0, ofGetWidth(), 0.05, 1.0, true ); eTimeCounter += deltaTime * mouseXPercent; - + float offset = ofMap( ofGetMouseY(), 10, ofGetHeight()-10, 0, 100, true); - + float polylinePercent = ofWrap( eTimeCounter, 0, 1); float findex = oLine.getIndexAtPercent(polylinePercent); - + auto position = oLine.getPointAtPercent( polylinePercent ); auto normal = oLine.getNormalAtIndexInterpolated(findex); normal *= sin( elapsedTime * 13.4f ) * cos(elapsedTime * 2.4f); normal.z = 0.0; position += normal * offset; - + ofPushMatrix(); // translate to the center of the fbo // ofTranslate( maskFbo.getWidth()/2., maskFbo.getHeight() / 2. ); @@ -110,15 +110,15 @@ void ofApp::draw(){ ofTranslate( -oLine.getBoundingBox().getWidth()*0.75f, 0.0f ); brushImage.draw(position.x, position.y, brushSize, brushSize); ofPopMatrix(); - - + + findex = fLine.getIndexAtPercent(polylinePercent); position = fLine.getPointAtPercent( polylinePercent ); normal = fLine.getNormalAtIndexInterpolated(findex); normal *= sin( elapsedTime * 9.4f ) * cos(elapsedTime * 5.4f); normal.z = 0.0; position += normal * offset; - + ofPushMatrix(); // translate to the center of the fbo // ofTranslate( maskFbo.getWidth()/2., maskFbo.getHeight() / 2. ); @@ -127,7 +127,7 @@ void ofApp::draw(){ ofTranslate( fLine.getBoundingBox().getWidth()*0.75f, 0.0f ); brushImage.draw(position.x, position.y, brushSize, brushSize); ofPopMatrix(); - + maskFbo.end(); //---------------------------------------------------------- @@ -144,7 +144,7 @@ void ofApp::draw(){ brushImage.draw(brushImageX, brushImageY, brushSize, brushSize); maskFbo.end(); } - + //---------------------------------------------------------- // HERE the shader-masking happens shader.begin(); @@ -169,9 +169,9 @@ void ofApp::draw(){ ofTranslate(ofGetWidth()/2, ofGetHeight()/2 ); drawMesh.draw(); ofPopMatrix(); - + shader.end(); - + //---------------------------------------------------------- float drawStringY = 0; ofDrawBitmapStringHighlight("Drag the Mouse to draw. Mode (e): "+string(bEraser?"eraser":"brush"), 15,drawStringY+=15); @@ -217,7 +217,7 @@ void ofApp::keyReleased(int key){ //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y){ - + } //-------------------------------------------------------------- @@ -246,6 +246,6 @@ void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- -void ofApp::dragEvent(ofDragInfo dragInfo){ +void ofApp::dragEvent(ofDragInfo dragInfo){ } diff --git a/examples/sound/soundPlayerFFTExample/src/ofApp.cpp b/examples/sound/soundPlayerFFTExample/src/ofApp.cpp index d53ace59d66..488c6a799c5 100644 --- a/examples/sound/soundPlayerFFTExample/src/ofApp.cpp +++ b/examples/sound/soundPlayerFFTExample/src/ofApp.cpp @@ -2,7 +2,7 @@ //-------------------------------------------------------------- -void ofApp::setup(){ +void ofApp::setup(){ // load in sounds: beat.load("sounds/jdee_beat.mp3"); @@ -14,16 +14,16 @@ void ofApp::setup(){ //-------------------------------------------------------------- void ofApp::update(){ - + ofBackground(80,80,20); // update the sound playing system: - ofSoundUpdate(); - + ofSoundUpdate(); + // (1) we increase px and py by adding vx and vy px += vx; py += vy; - + // (2) check for collision, and trigger sounds: // horizontal collisions: if (px < 0){ @@ -51,22 +51,22 @@ void ofApp::update(){ // (4) we use velocity for volume of the samples: float vel = sqrt(vx*vx + vy*vy); - ow.setVolume(MIN(vel/5.0f, 1)); - beat.setVolume(MIN(vel/5.0f, 1)); - dog.setVolume(MIN(vel/5.0f, 1)); - rooster.setVolume(MIN(vel/5.0f, 1)); + ow.setVolume(std::min(vel/5.0f, 1.0f)); + beat.setVolume(std::min(vel/5.0f, 1.0f)); + dog.setVolume(std::min(vel/5.0f, 1.0f)); + rooster.setVolume(std::min(vel/5.0f, 1.0f)); // (5) grab the fft, and put in into a "smoothed" array, // by taking maximums, as peaks and then smoothing downward float * val = ofSoundGetSpectrum(nBandsToGet); // request 128 values for fft for (int i = 0;i < nBandsToGet; i++){ - + // let the smoothed value sink to zero: fftSmoothed[i] *= 0.96f; - + // take the max, either the smoothed or the incoming: if (fftSmoothed[i] < val[i]) fftSmoothed[i] = val[i]; - + } @@ -75,46 +75,46 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - + ofEnableAlphaBlending(); ofSetColor(255,255,255,100); ofDrawRectangle(100,ofGetHeight()-300,5*128,200); ofDisableAlphaBlending(); - + // draw the fft resutls: ofSetColor(255,255,255,255); - + float width = (float)(5*128) / nBandsToGet; for (int i = 0;i < nBandsToGet; i++){ // (we use negative height here, because we want to flip them // because the top corner is 0,0) ofDrawRectangle(100+i*width,ofGetHeight()-100,width,-(fftSmoothed[i] * 200)); } - + // finally draw the playing circle: ofEnableAlphaBlending(); ofSetColor(255,255,255,20); ofDrawCircle(px, py,50); ofDisableAlphaBlending(); - + ofSetHexColor(0xffffff); ofDrawCircle(px, py,8); } //-------------------------------------------------------------- -void ofApp::keyPressed (int key){ +void ofApp::keyPressed (int key){ } //-------------------------------------------------------------- -void ofApp::keyReleased(int key){ - +void ofApp::keyReleased(int key){ + } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ - + } //-------------------------------------------------------------- @@ -126,7 +126,7 @@ void ofApp::mouseDragged(int x, int y, int button){ prevx = x; prevy = y; } - + //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ prevx = x; @@ -159,7 +159,6 @@ void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- -void ofApp::dragEvent(ofDragInfo dragInfo){ +void ofApp::dragEvent(ofDragInfo dragInfo){ } -