示例#1
0
/**
Attempt at recursively drawing hollow rectangles to create a 
larger shape. 
**/
void recursiveFun(int r, int c, int width, int height, u16 color) {
    if (width >= 2) {
        drawHollowRect(r, c, height, width, color);
        recursiveFun(r+1, c, height - 2, width/2, color);
        recursiveFun(r, c+1, height - 2, width/2, color);
    }
}
void recursiveFun(float _xPos, float _yPos){
    float xPos = _xPos;
    float yPos = _yPos;
    float speed = 5;
    
    ofSetColor(255, 0, 0);
    ofFill();
    
    float rand = ofRandomf();
    cout << rand << endl;
    
    if(rand >= 0){
        float newX = xPos + ofRandom(-5,5);
        float newY = yPos - speed;
    
        ofDrawLine(xPos, yPos, newX, newY);
    
        recursiveFun(newX, newY);
    }
}