Exemplo n.º 1
0
/*
 * Function: drawSun
 * Usage: if(sun->isSelected()) drawSun(gw,MAX_SUN_RADIUS,(dusk?DUSK_SUN_COLOR:DAY_SUN_COLOR));
 * --------------------------
 * Uses a recursive function to draw the sun/moon as series of concentric circles.
 * Totally unnecessary to do this recursively, but it's the recursive contest. #YOLO
 */
int drawSun(GWindow gw, int radius, int color){
    if(radius<=0){
        return 0;
    }
    GOval *oval;
    if(dusk){
        oval = new GOval(width/4-radius,height*.45-radius,radius*2,radius*2);
    }
    else{
        radius/=2;
        oval = new GOval(2.0*width/3.0-radius,height/3.0-radius,radius*2,radius*2);
        radius*=2;
    }
    oval->setColor(color);
    oval->setFilled(true);
    oval->setColor(color);
    gw.add(oval);
    radius--;
    color -=2;
    return drawSun(gw, radius, color);
}