//-------------------------------------------------------------- void ofApp::draw(){ // If the left mouse button is pressed... if (ofGetMousePressed(OF_MOUSE_BUTTON_LEFT)) { int maxRadius = 100; // Increase for a wider brush int radiusStepSize = 5; // Decrease for more circles (i.e. a more opaque brush) int alpha = 3; // Increase for a more opaque brush int maxOffsetDistance = 100; // Increase for a larger spread of circles for (int radius=maxRadius; radius>0; radius-=radiusStepSize) { // Formula for converting from polar to Cartesian coordinates: // x = cos(polar angle) * (polar distance) // y = sin(polar angle) * (polar distance) // We need our angle to be in radians if we want to use sin() or cos() // so we can make use of an openFrameworks function to convert from degrees // to radians float angle = ofRandom(ofDegToRad(360.0)); float distance = ofRandom(maxOffsetDistance); float xOffset = cos(angle) * distance; float yOffset = sin(angle) * distance; // Using the ofColor class, we will randomly select a color between orange and red ofColor myOrange(255, 132, 0, alpha); ofColor myRed(255, 6, 0, alpha); ofColor inBetween = myOrange.getLerped(myRed, ofRandom(1.0)); ofSetColor(inBetween); ofCircle(ofGetMouseX()+xOffset, ofGetMouseY()+yOffset, radius); } } // If the right mouse button is pressed... if (ofGetMousePressed(OF_MOUSE_BUTTON_RIGHT)) { ofBackground(0); // Erase the screen with a black background } }
MainMenuTextButton::MainMenuTextButton(std::string str, sf::Font& font) : TextButton(), // _game() { sf::Text text; text.setFont(font); text.setCharacterSize(30); sf::Color myOrange(210, 100, 0); text.setColor(myOrange); text.setString(str); sf::RectangleShape button(sf::Vector2f(130, 40)); button.setFillColor(sf::Color::Cyan); TextButton::setText(text); TextButton::setButton(button); }