//-------------------------------------------------------------- void testApp::draw(){ ofBackground(ofColor::white); ofSetColor(255); textLong.draw(textLongPos.x,textLongPos.y); panel.begin(); for (int i = 0; i < 100; i++) { ofSetColor(255, 0, 255); ofCircle(0, i*45, ofMap(sin(ofGetElapsedTimef()), -1, 1, 10, 40)); } panel.end(); //Just squares to show the dimensions of the scrollable zone and fade ofSetColor(0); ofNoFill(); ofSetRectMode(OF_RECTMODE_CENTER); ofRect(ofGetWidth()*0.25,ofGetHeight()*0.5,textLong.getWidth(),textLong.getHeight()); ofLine(ofGetWidth()*0.25-textLong.getWidth()*0.5,ofGetHeight()*0.5-textLong.getHeight()*0.5+FADE_SIZE,ofGetWidth()*0.25+textLong.getWidth()*0.5,ofGetHeight()*0.5-textLong.getHeight()*0.5+FADE_SIZE); ofLine(ofGetWidth()*0.25-textLong.getWidth()*0.5,ofGetHeight()*0.5+textLong.getHeight()*0.5-FADE_SIZE,ofGetWidth()*0.25+textLong.getWidth()*0.5,ofGetHeight()*0.5+textLong.getHeight()*0.5-FADE_SIZE); //Just squares to show the dimensions of the scrollable zone and fade ofSetColor(0); ofNoFill(); ofSetRectMode(OF_RECTMODE_CENTER); ofRect(ofGetWidth()*0.75,ofGetHeight()*0.5,textLong.getWidth(),textLong.getHeight()); ofLine(ofGetWidth()*0.75-textLong.getWidth()*0.5,ofGetHeight()*0.5-textLong.getHeight()*0.5+FADE_SIZE,ofGetWidth()*0.75+textLong.getWidth()*0.5,ofGetHeight()*0.5-textLong.getHeight()*0.5+FADE_SIZE); ofLine(ofGetWidth()*0.75-textLong.getWidth()*0.5,ofGetHeight()*0.5+textLong.getHeight()*0.5-FADE_SIZE,ofGetWidth()*0.75+textLong.getWidth()*0.5,ofGetHeight()*0.5+textLong.getHeight()*0.5-FADE_SIZE); // ofSetRectMode(OF_RECTMODE_CORNER); }
//-------------------------------------------------------------- void testApp::draw() { ofNoFill(); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255); ofCircle(mouseX, mouseY, 10); //mouseX and mouseY are currently not working reliably ofSetRectMode(OF_RECTMODE_CORNER); ofFill(); ofSetColor(255); ofVec2f mp=mousePos; ofVec2f p; float dSquared=100*100; for(int x=0; x<ofGetWidth(); x+=40) { for(int y=0; y<ofGetHeight(); y+=40) { p.set(x, y); if(mp.distanceSquared(p)<dSquared) { ofRect(x+10, y+10, 20, 20); } } } ofSetColor(0); ofDrawBitmapString(ofToString(ofGetFrameRate()),20,20); }
void arduinoGrapher::drawBaudGui(){ ofPushMatrix(); ofTranslate(baudPaneX, baudPaneY); ofSetRectMode(OF_RECTMODE_CENTER); ofSetHexColor(black); ofRect(0, 0, baudPaneW+8, baudPaneH+8); ofSetHexColor(offBlack); ofRect(0, 0, baudPaneW, baudPaneH); ofTranslate(-baudPaneW/2, -baudPaneH/2+50); for (int i=0; i<11; i++){ if (insideCentreRect(mouseX, mouseY, baudPaneX, i*28+baudPaneY-(baudPaneH/2)+38, 150, 25)){ ofCircle(20, 28*i-12, 10); ofSetHexColor(darkGrey); }else{ ofSetHexColor(white); } verdana20.drawString(ofToString(serial.baudRates[i]), 30, 28*i); } ofSetRectMode(OF_RECTMODE_CORNER); ofPopMatrix(); }
//---------------------------------------------- void ttChar::draw(){ ofSetColor(255,255); ofSetRectMode(OF_RECTMODE_CENTER); ofPushMatrix(); ofTranslate(getPos); //turn left flip if (mirrorLeft) ofScale(-1, 1); //if no picture files, draw box2d rect instead if ((int)sprite.size() <=0 ) { ofSetColor(255, 30, 220,100); character.draw(); } int frameIndex = 0; frameIndex = (int) (ofGetElapsedTimef() * 24) % sprite.size(); if (character.getVelocity().lengthSquared() > 0) { sprite[frameIndex].draw (0,0, adjustedHeight, adjustedHeight); } else{ sprite[16].draw(0,0, adjustedHeight, adjustedHeight); } ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); }
//-------------------------------------------------------------- void ofApp::draw(){ if (savePDF){ ofBeginSaveScreenAsPDF("recording-"+ofGetTimestampString()+".pdf", true); } float hue = ofMap(mouseX,0,ofGetWidth(),0,255); c.setHue(hue); ofSetColor(c); ofSetRectMode(OF_RECTMODE_CORNER); //ofNoFill(); //ofBackground(mouseY/2,100,100); ofRect( 0, 0, ofGetWidth(), ofGetHeight() ); float antiHue = 255.0 - hue; b.setHue(antiHue); ofFill(); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(b); ofRect(ofGetWidth() / 2, ofGetHeight() / 2, ofGetHeight() - mouseY, ofGetHeight() - mouseY ); if (savePDF){ savePDF = false; ofEndSaveScreenAsPDF(); } }
void Enemy::draw(int &_frameNum){ // Matt // drawWings(); ofSetRectMode(OF_RECTMODE_CORNER); ofPushMatrix();{ ofTranslate(pos.x , pos.y); { // Matt // Draw the health bar ofSetRectMode( OF_RECTMODE_CORNER ); float offset = 1; float hoffSet = ( metroid[ 0 ].getWidth() * 0.25 ) / 2; float voffSet = metroid[ 0 ].getHeight() - 50; float offsetBar = 10; float barHeight = 10; float barLength = metroid[ 0 ].getWidth() * 0.75; float currentHealth = ofMap( health, 0, healthMax, 0, barLength - offset * 2 ); // The border. ofSetColor( 255 ); ofNoFill(); ofRect( hoffSet, voffSet, barLength, barHeight ); ofFill(); // The current health. ofSetColor( 0, 255, 0 ); ofRect( hoffSet + offset, voffSet + offset, currentHealth, barHeight - offset * 2 ); } // End Matt ofSetColor(255); //Matt metroid[_frameNum].draw(0,0); }ofPopMatrix(); }
void ofApp::update(){ for(int i = 0; i < numLayers; i++) { masker.beginLayer(i); { textures.at(i).incrementTextureOffsetY(ofMap(i, 0, numLayers-1, -speed, speed)); textures.at(i).draw(); } masker.endLayer(i); masker.beginMask(i); { masks.at(i).incrementTextureOffsetY(ofMap(i, 0, numLayers-1, speed * 0.125, -speed * 0.125)); masks.at(i).draw(); } masker.endMask(i); } masker.beginLayer(numLayers); { ofBackground(ofColor::white); masker.drawLayers(0, numLayers-1); } masker.endLayer(numLayers); masker.beginMask(numLayers); { ofBackground(ofColor::black); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(ofColor::white); ofRect(gif.halfWidth, gif.halfHeight, rectSize, rectSize); ofSetRectMode(OF_RECTMODE_CORNER); } masker.endMask(numLayers); }
//---------------------------------------------------- void guiQuad::draw(float x, float y, float width, float height, int red, int green, int blue, int thickness){ getScaledQuadPoints(width, height); glPushMatrix(); glTranslatef(x, y, 0); ofNoFill(); ofSetColor(red, green, blue); glLineWidth(thickness); glBegin(GL_LINE_LOOP); for(int i = 0; i < 4; i++){ glVertex2f(srcScaled[i].x, srcScaled[i].y); } glEnd(); glLineWidth(1); ofSetRectMode(OF_RECTMODE_CENTER); for(int i = 0; i < 4; i++){ if(i == 0)ofSetColor(255, 0, 0); if(i == 1)ofSetColor(0, 255, 0); if(i == 2)ofSetColor(0, 0, 255); if(i == 3)ofSetColor(0, 255, 255); ofRect(srcScaled[i].x, srcScaled[i].y, 8, 8); } ofSetColor(255, 0, 0); ofCircle(anchorPointScaled.x, anchorPointScaled.y, 4); ofDrawBitmapString("+", anchorPointScaled.x - 4, anchorPointScaled.y + 4); ofSetRectMode(OF_RECTMODE_CORNER); ofFill(); glPopMatrix(); }
void ofApp::colorPicker(){ if (colorPickerRect.inside(mouseX, mouseY)) { ofSetRectMode(OF_RECTMODE_CORNER); img.draw(ofGetWidth()-ofGetWidth()/6,ofGetHeight()-ofGetHeight()/6); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255,255,255,200); ofRect(mouseX+10, mouseY, 30, 30); colorPicked.set(img.getColor(mouseX-(ofGetWidth()-ofGetWidth()/6), mouseY-(ofGetHeight()-ofGetHeight()/6))); ofSetColor(colorPicked); ofRect(mouseX+10, mouseY, 20, 20); ofFill(); ofSetColor(255); ofPushMatrix(); // ofDrawBitmapString(ofToString( colorPicked), 50,500); } }
//------------------------------------------------------------------ void rectangle::draw( int colori) { ofFill(); ofSetRectMode(OF_RECTMODE_CENTER); // center around the position // ofSetColor(198,246,55); ofPushMatrix(); ofTranslate(pos.x, pos.y); ofRotateZ(angle * RAD_TO_DEG); ofEnableAlphaBlending(); ofSetColor(233, 244, 201, 155-colori*2); ofRect( 0,0, scl.x, scl.y*1.2); ofSetColor(198-colori*5, 246-colori*5, 55, 200-colori*2); //ofCircle(0, 0, scl.y*4); ofEllipse(0, 0, scl.x, scl.y*4); ofDisableAlphaBlending(); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); }
void testApp::draw(){ int w = getW(); int h = getH(); if(bCap){ ofBeginSaveScreenAsPDF(pdfCapturePath, false, false, ofRectangle(0,0,w,h)); } ofBackground(0); if(gprm.bBlack){ return; } // cam.begin(); // ofRotate(180, 1, 0, 0); // ofTranslate(-w/2, -h/2); if(bCap){ //ofBeginSaveScreenAsPDF(pdfCapturePath, false, false, ofRectangle(0,0,w,h)); gps->drawForPdf(); ofEndSaveScreenAsPDF(); bCap = false; }else{ gps->draw(); } // cam.end(); if(gprm.bTestPicture){ ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255, 255, 255, 150); float asp = wc.getWidth()/wc.getHeight(); wc.draw(w/2, h/2, h*asp, h); ofSetRectMode(OF_RECTMODE_CORNER); } }
//--------------------------------------------- void ProcessFFT::drawBars(){ if(normalize){ ofPushStyle(); ofSetRectMode(OF_RECTMODE_CORNER); ofSetLineWidth(2); for(int i=0; i<fftSpectrum.size(); i++){ //for the number of columns if (i==loudestBand) { ofSetColor(255,0,0); } else{ ofSetColor(100,100,200); } ofNoFill(); ofDrawRectangle(ofGetWidth()*((float)i/numFFTbins), ofGetHeight()-20, ofGetWidth()/numFFTbins, -ofMap(fftSpectrum[i], 0, 1, 0, ofGetHeight() -50)); } ofPopStyle(); }else{ //not normalized ofPushStyle(); ofSetRectMode(OF_RECTMODE_CORNER); ofSetLineWidth(2); for(int i=0; i<fftSpectrum.size(); i++){ //for the number of columns if (i==loudestBand) { ofSetColor(255,0,0); } else{ ofSetColor(100,100,200); } ofNoFill(); ofDrawRectangle(ofGetWidth()*((float)i/numFFTbins), ofGetHeight()-20, ofGetWidth()/numFFTbins, -ofMap(fftSpectrum[i], 0, volumeRange, 0, ofGetHeight() -50)); } ofPopStyle(); } }
//-------------------------------------------------------------- void ofApp::draw() { ofEnableAlphaBlending(); ofSetColor(0,130,130, 200); ofSetColor(255,255,255,80); ofSetRectMode(OF_RECTMODE_CENTER); for (int i = 0; i < particles.size(); i++) { particles[i].draw(); } ofSetRectMode(OF_RECTMODE_CORNER); string reportString = "(space) = reset\n(a/s) strength = " + ofToString(strength) + "\n(z/x) radius = " + ofToString(radius) + "\n(r) toggle mode = " + (bRepel ? "repelling" : "attracting"); ofSetColor(40,40,0); ofRect(10,10,300,80); ofSetColor(255,255,255); ofDrawBitmapString(reportString, 30, 30); }
//-------------------------------------------------------------- void textImageDisplay::draw(float x, float y, string word, string letter){ ofFill(); ofSetColor(255, 0, 100); //myImage.resize(oldSize_w*2, oldSize_h*2); displayWord.renderString(word, x, y); if (isImageBig == false)displayLetter.renderString(letter, x+myImage.width*imageScaleAmount+15, y+115); if (isImageBig == true)displayLetter.renderString(letter, x, y+115); ofSetColor(255, 255, 255); boundingBox.set(x, y, myImage.width*imageScaleAmount, myImage.height*imageScaleAmount); if (isImageBig == false){ ofEnableAlphaBlending(); //ofSetRectMode(OF_RECTMODE_CENTER); // center around the position ofPushMatrix(); ofTranslate(x, y+12, 0); ofScale(imageScaleAmount, imageScaleAmount, 1); myImage.draw(0, 0); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); ofDisableAlphaBlending(); } if (isImageBig == true){ ofEnableAlphaBlending(); //ofSetRectMode(OF_RECTMODE_CENTER); // center around the position ofPushMatrix(); ofTranslate(ofGetWidth()-470, ofGetHeight()-480, 0); ofScale(imageScaleAmount, imageScaleAmount, 1); myImageBig.draw(0, 0); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); ofDisableAlphaBlending(); } }
//---------------------------------------------- void ttChar::draw(){ ofSetColor(color); ofSetRectMode(OF_RECTMODE_CENTER); ofPushMatrix(); ofTranslate(character.getPosition()); //turn left flip if (mirrorLeft) ofScale(-1, 1); if (charNum == 0) ofScale(-1, -1); //if no picture files, draw box2d rect instead if ((int)sprite.size() <=0 ) { ofSetColor(255, 30, 220,100); character.draw(); } int frameIndex = 0; // walkFrameIndex = (int) (ofGetElapsedTimef() * 24) % sprite.size(); if (!bSwing) { if(character.getVelocity().x != 0){ frameIndex = (int) (ofGetElapsedTimef() * 24) % fAmountWalk; sprite[fOffsetWalk+frameIndex].draw (0,0, adjustedHeight, adjustedHeight); }else{ sprite[fOffsetWalk+16].draw(0,0, adjustedHeight, adjustedHeight); } }else{ frameIndex = (int) (ofGetElapsedTimef() * 24) % fAmountPull; sprite[fOffsetPull +frameIndex].draw(0,0, adjustedHeight, adjustedHeight); } ofSetRectMode(OF_RECTMODE_CORNER); ofDrawBitmapStringHighlight(ofToString(frameIndex), -20,-20); ofPopMatrix(); }
void drawMindsetStatus(ofxThinkgearEventArgs& data){ // ofPushStyle(); // f*****g bug ofSetRectMode(OF_RECTMODE_CENTER); ofPushMatrix(); ofTranslate(ofGetWidth() - 100, 100); ofFill(); ofSetCircleResolution(100); ofSetColor(0, 0, 0, 128); ofCircle(0, 0, 52); // Show connection state switch (tgState){ case NONE: ofSetColor(0, 0, 0); break; case CONNECTING: ofSetColor(200, 200, 0); break; case BAD_SIGNAL: ofSetColor(200, 0, 0); break; case READY: ofSetColor(0, 200, 0); break; } ofRect(0, 0, 10, 10); if (true || tgState == READY){ // MindSet info pad ofSetColor(200, 200, 200); float w = smallFont.stringWidth(ofToString(data.raw)); smallFont.drawString(ofToString(data.raw), -w/2, -38); ofSetColor(200+55*(medScore/200), 200, 200); ofCircle(20, -20, min(1.0, data.meditation/100.0) * 16); ofSetColor(200+55*(attScore/200), 200, 200); ofCircle(-20, -20, min(1.0, data.attention/100.0) * 16); ofSetColor(200, 200, 200); ofRect(40-15*eegData.midGamma.ratio, 0, 30*eegData.midGamma.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.lowGamma.ratio, 0, 30*eegData.lowGamma.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.highBeta.ratio, 0, 30*eegData.highBeta.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.lowBeta.ratio, 0, 30*eegData.lowBeta.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.highAlpha.ratio, 0, 30*eegData.highAlpha.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.lowAlpha.ratio, 0, 30*eegData.lowAlpha.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.theta.ratio, 0, 30*eegData.theta.ratio, 10); ofRotate(25.7, 0, 0, 1); ofRect(40-15*eegData.delta.ratio, 0, 30*eegData.delta.ratio, 10); } ofPopMatrix(); // ofPopStyle(); // f*****g bug ofSetRectMode(OF_RECTMODE_CORNER); // f*****g bug }
//-------------------------------------------------------------- void ofxFileDialog::drawFilenames(int offset, int bottomOffset, bool highlight) { int x = 0; float center = (m_height-s_charHeight*offset)*0.5; int top = -center+(s_charHeight*2); int bottom = center-(s_charHeight*bottomOffset); int displayRange = m_visibleLines-offset; // center vertically ofPushMatrix(); ofTranslate(0, m_visibleLines*0.5*s_charHeight); // start drawing based on current file location in file list so selection remains centered float y = (m_currentFile/(float)m_filenames.size()) * -s_charHeight * (float)m_filenames.size() + s_charHeight; unsigned int count = 0; for(vector<u32string>::iterator i = m_filenames.begin(); i != m_filenames.end(); i++) { m_numLines = 0; bool isDir = m_directories.find(count) != m_directories.end(); // don't draw on top of path if(y < top) { y += s_charHeight; count++; continue; } // only show numbers in the display range if(((int)count > ((int)m_currentFile - (int)displayRange)) && ((int)count < ((int)m_currentFile + (int)displayRange))) { for(int c = 0; c < i->size(); ++c) { // current file background if(highlight && count == m_currentFile) { ofSetColor(m_settings->getCursorColor().r, m_settings->getCursorColor().g, m_settings->getCursorColor().b, m_settings->getCursorColor().a * m_settings->getAlpha()); ofRectMode rectMode = ofGetRectMode(); ofSetRectMode(OF_RECTMODE_CORNER); ofDrawRectangle(x, y-s_charHeight, characterWidth((*i)[c]), s_charHeight); ofSetRectMode(rectMode); } // file or dir name x = s_font->drawCharacter((*i)[c], x, y, s_textShadow); } x = 0; } y += s_charHeight; count++; // don't draw beyond bottom if(y > bottom) { break; } } ofPopMatrix(); }
void ofxGLFWJoystick::drawDebug(int x, int y){ ofPushMatrix(); ofPushStyle(); ofTranslate(x, y); int joyRad = 25; int buttonSize = 20; int padding = 10; float yOffset = 0; for(int j = 0; j < numJoysticks; j++){ ofTranslate(0 , yOffset); int xOffset = joyRad * 0.5f; bool joyOK = glfwJoystickPresent(j); if(joyOK){ string msg = "'" + joyData[j].name + "' numAxis: " + ofToString(joyData[j].numAxis) + " numButtons: " + ofToString(joyData[j].numButtons); ofSetColor(255); ofDrawBitmapString(msg, 0, - 22); for(int i = 0; i < joyData[j].numAxis; i+=2){ ofSetColor(255, 128); float xx = xOffset + joyRad * 0.5f; float yy = joyRad * 0.5f; ofCircle(xx, yy, joyRad); float x = joyData[j].axisData[i] * joyRad; float y = 0; if(i + 1 < joyData[j].numAxis ){ y = joyData[j].axisData[i + 1] * joyRad; } ofColor c; c.setHsb((i * 16)%255, 255, 255); ofSetColor(c); ofDrawArrow(ofVec2f(xx, yy), ofVec2f(xx + x, yy + y), 4); xOffset += joyRad * 2 + padding; } ofSetRectMode(OF_RECTMODE_CENTER); for(int i = 0; i < joyData[j].numButtons; i ++ ){ bool pressed = joyData[j].buttonData[i] > 0; //mmm not sure why its a char if its only 0/1 ofSetColor( pressed ? 0:255, pressed ? 255:0, 0 ); ofRect(xOffset, joyRad * 0.5, joyRad * 0.7, joyRad * 0.7); ofSetColor(255); ofDrawBitmapString(ofToString(i), xOffset - 7, joyRad * 0.5 + 22); xOffset += joyRad + padding * 0.5; } ofSetRectMode(OF_RECTMODE_CORNER); yOffset = joyRad * 2 + 4 * padding; } } ofPopStyle(); ofPopMatrix(); }
void testApp::drawRectsR(int k,int j) { ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255,0,0,a); rr = 8.0 * r / 255.0; ofRect(k,j,rr,rr); ofSetRectMode(OF_RECTMODE_CORNER); }
void testApp::drawRectsG(int k,int j) { ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(0,255,0,a); gr = 8.0 * g / 255.0; ofRect(k,j,gr,gr); ofSetRectMode(OF_RECTMODE_CORNER); }
void testApp::drawRectsB(int k,int j) { ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(0,0,255,a); br = 8.0 * b / 255.0; ofRect(k,j,br,br); ofSetRectMode(OF_RECTMODE_CORNER); }
void testApp::drawRaw(){ //ofSetColor(0); ofNoFill(); //ofRect(1, 1, screenWidth + 2, screenHeight); ofFill(); glPushMatrix(); glTranslatef(screenWidth/2,screenHeight/2,0); for(int i = 0; i < stars2d.size(); i ++){ for(int j = 0; j < stars2d[i].size(); j ++){ stars2d[i][j]->drawBG(false); } } for(int i = 0; i < stars2d.size(); i ++){ for(int j = 0; j < stars2d[i].size(); j ++){ stars2d[i][j]->drawActiveAlgorithm(); } } glPopMatrix(); if(showPoints){ glPushMatrix(); glTranslatef(screenWidth/2,screenHeight/2,0); ofFill(); for(int i =0; i <activeList.size(); i++){ if(activeList[i]->isMoving){ ofCircle(activeList[i]->pos.x, activeList[i]->pos.y, 10); }else{ ofSetRectMode(OF_RECTMODE_CENTER); ofRect(activeList[i]->pos.x, activeList[i]->pos.y, 10,10); ofSetRectMode(OF_RECTMODE_CORNER); } } glPopMatrix(); } ofSetColor(230,255,230, 25); bg.draw(0, 0,screenWidth * 1.5,screenHeight); }
void SakuraParticle::draw(){ ofSetColor(color); ofSetRectMode(OF_RECTMODE_CENTER); ofPushMatrix(); ofTranslate(position); ofRotateX(rot.x); ofRotateY(rot.y); ofRotateZ(rot.z); ofEllipse(0, 0, radius, radius * 1.4); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CORNER); }
//-------------------------------------------------------------- void testApp::draw(){ //bg ofSetColor(255); ofSetRectMode(OF_RECTMODE_CENTER); backgroundImage.draw(bgPos.x+400,bgPos.y+370); ofSetRectMode(OF_RECTMODE_CORNER); //myParticles for (int i = 0; i < myParticles.size(); i++){ ofFill(); ofEnableAlphaBlending(); ofSetColor(255, 220, 0, 10); ofCircle(myParticles[i]->pos,myParticles[i]->radius*myParticles[i]->scale); ofDisableAlphaBlending(); } for (int i = 0; i < myParticles.size(); i++){ myParticles[i]->draw(); } //ship float diffTime2 = ofGetElapsedTimeMillis()- firstTime; if(diffTime2<1000) { float buleAlpha = ofMap(diffTime2, 0, 1000, 0, 100); ofEnableAlphaBlending(); ofSetColor(0, 100, 200,100-buleAlpha); ofCircle(ship.pos.x, ship.pos.y,100); ofDisableAlphaBlending(); } ship.draw(); //goals for (int i = 0; i < goals.size(); i++){ goals[i]->draw(); } //score if (score>29) { ofSetColor(255, 255, 255); verdana2.drawString("VICTORY", ofGetWidth()/2-120, ofGetHeight()/2); } ofSetColor(225); verdana.drawString("Survivor: "+ofToString(30-score), 30, 35); verdana.drawString("Shield: "+ofToString(shield), 500, 35); }
//-------------------------------------------------------------- void ofxFileDialog::drawSaveAs() { bool drawnCursor = false; int x = 0, y = s_charHeight; s_font->setColor(m_settings->getTextColor(), m_settings->getAlpha()); s_font->setShadowColor(m_settings->getTextShadowColor(), m_settings->getAlpha()); if(m_saveAsState == FOLDER_DIALOG) { drawNewFolder(); } else { ofPushMatrix(); ofTranslate(0, s_charHeight*2); // info text s_font->drawString(s_saveAsText, x, y, s_textShadow); // new file name with cursor y += s_charHeight*2; for(unsigned int i = 0; i < m_text.size(); ++i) { // draw cursor if(m_saveAsState == FILENAME && i == m_position) { drawCursor(x, y); drawnCursor = true; } // text x = s_font->drawCharacter(m_text[i], x, y, s_textShadow); } // draw cursor if we have no text, or if we're at the end of the buffer if(m_saveAsState == FILENAME && !drawnCursor) { drawCursor(x, y); } drawFilenames(5, 2, m_saveAsState == BROWSER); ofPopMatrix(); y = m_height-s_charHeight; if(m_saveAsState == FOLDER) { int width = s_font->stringWidth(s_newFolderButtonText); ofSetColor(m_settings->getCursorColor().r, m_settings->getCursorColor().g, m_settings->getCursorColor().b, m_settings->getCursorColor().a * m_settings->getAlpha()); ofRectMode rectMode = ofGetRectMode(); ofSetRectMode(OF_RECTMODE_CORNER); ofDrawRectangle(x, y-s_charWidth, width, s_charHeight); ofSetRectMode(rectMode); } s_font->drawString(s_newFolderButtonText, 0, y, s_textShadow); } }
void SmartPoly::drawShapeImage(){ // Only draw a shape image if we have one if( shapeImageOut.isAllocated()){ switch(interactionMode){ case SHAPE_INTERACTION_MODE_NORMAL: case SHAPE_INTERACTION_MODE_HEIGHTMAP: case SHAPE_INTERACTION_MODE_EXTRUDE: ofPushMatrix(); ofPushStyle(); ofTranslate(pos); ofRotate(rotation); ofSetRectMode(OF_RECTMODE_CENTER); // Alpha blending for transparent pixels ofEnableAlphaBlending(); ofColor(255,255,255); shapeImageOut.draw(0,0); ofPopStyle(); ofPopMatrix(); break; case SHAPE_INTERACTION_MODE_POPUP: ofPushMatrix(); ofPushStyle(); ofTranslate(pos.x, pos.y); ofRotate(rotation); //Pop out the shape //TODO: Determine what rotation is correcte for popup ofRotateY(90); ofTranslate(0,- boundingBox.height/2); ofSetRectMode(OF_RECTMODE_CENTER); // Alpha blending for transparent pixels ofEnableAlphaBlending(); ofColor(255,255,255); shapeImageOut.draw(0,0); ofPopStyle(); ofPopMatrix(); break; } } }
//------------------------------------------ void directionButton::draw(){ ofSetRectMode(OF_RECTMODE_CENTER); ofFill(); bPressed==true ? color.set(255,255, 255, 200): color.set(255, 255, 255, 125); if (bFixed) color.set(255, 255, 255,30); ofSetColor(color); ofPushMatrix(); ofTranslate(rect.getCenter()); ofRotateZ(angle); img.draw(0, 0, rect.getWidth(), rect.getHeight()); ofPopMatrix(); ofSetRectMode(OF_RECTMODE_CENTER); }
//---------------------------------------------------- void ofxCvCoordWarpingGui::draw(float passedX, float passedY, float scaleWidth, float scaleHeight, int red, int green, int blue, int thickness){ getScaledQuadPoints(scaleWidth, scaleHeight); ofPushMatrix(); ofPushStyle(); ofTranslate(passedX, passedY); ofNoFill(); ofSetColor(red, green, blue); ofSetLineWidth(thickness); ofBeginShape(); for(int i = 0; i < 4; i++){ ofVertex(srcScaled[i].x, srcScaled[i].y); } ofEndShape(true); ofFill(); glLineWidth(1); ofSetRectMode(OF_RECTMODE_CENTER); for(int i = 0; i < 4; i++){ if(i == 0)ofSetColor(255, 0, 0); if(i == 1)ofSetColor(0, 255, 0); if(i == 2)ofSetColor(255, 255, 0); if(i == 3)ofSetColor(0, 255, 255); ofRect(srcScaled[i].x, srcScaled[i].y, 8, 8); } ofSetRectMode(OF_RECTMODE_CORNER); ofFill(); ofSetColor(255,255,255,50); ofSetPolyMode(OF_POLY_WINDING_ODD); ofBeginShape(); ofVertex(0, 0); ofVertex(scaleWidth, 0); ofVertex(scaleWidth, scaleHeight); ofVertex(0, scaleHeight); ofVertex(0, 0); for(int i = 0; i < 4; i++){ ofVertex(srcScaled[i].x, srcScaled[i].y); } ofVertex(srcScaled[0].x+1, srcScaled[0].y+1); ofEndShape(); ofSetHexColor(0xffffff); ofPopStyle(); ofPopMatrix(); }
void Pod::display() { float width = getWidth(); float height = getHeight(); ofPushMatrix(); ofSetRectMode(OF_RECTMODE_CENTER); ofTranslate(getPosition()); ofRotateZ(getRotation()); // ofSetColor(color); ofFill(); // passenger->draw(0, 0); image->draw(0,0); ofSetRectMode(OF_RECTMODE_CORNER); ofPopMatrix(); }
void IntroductionView::Draw(Model &model) { ofBackground(ofColor::black); IntroductionModel &introduction_model = dynamic_cast<IntroductionModel &>(model); ofSetRectMode(OF_RECTMODE_CORNER); ofSetColor(ofColor::white); background.draw(0, 0); ofSetRectMode(OF_RECTMODE_CENTER); ofPushMatrix(); ofMultMatrix(view_matrix); for (auto box : introduction_model.boxes) { DrawBox(OpenFrameworksVector(box->GetPosition()), box->GetAngle()); } ofPopMatrix(); }