// File: circles.cxx 01/11/2010
// Written by: Dmitry Duplyakin (Dmitry.Duplyakin@colorado.edu)
// The main purpose of this program is to show a first example of a C++ program
// Using the WinBGIm graphics library.

// Directives:
#include <graphics.h>
#include <cstdlib>
using namespace std;

//-----------------------------------------------------------------------------
// These are named constants that tell the size and position of things,
// starting with S, which is the size of the whole window (width and height):
const int S = 500;

// The postion and size of the first circle:
const int X1 = 0.67 * S;
const int Y1 = 0.5 * S;
const int RADIUS1 = 0.16 * S;

// The position and size of the second circle:
const int X2 = 0.33 * S;
const int Y2 = 0.25 * S;
const int RADIUS2 = 0.3 * S;

// The position and size of the snowmen:
const int SNOW_X1 = S/2;
const int SNOW_Y1 = S/2;
const int SNOW_SIZE1 = S/8;
const int SNOW_X2 = S/10;
const int SNOW_Y2 = S/8;
const int SNOW_SIZE2 = S/18;
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Function Prototypes.
// This is a list of all the functions that I plan to write because the
// author of the graphics library did not have them!
void snowman(int cx, int cy, int radius);
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// The main program defines wat the program will do. The commands are
// executed one after another from initwindow down to the final delay(20000).
int main()
{   
    initwindow(S, S, "First Program!");
    circle(X1, Y1, RADIUS1);
    delay(2000);
    circle(X2, Y2, RADIUS2);
    delay(2000);
    snowman(SNOW_X1, SNOW_Y1, SNOW_SIZE1);
    delay(2000);
    snowman(SNOW_X2, SNOW_Y2, SNOW_SIZE2);
    delay(20000);
}
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// This function draws a snowman. The center of the body is at (cx, cy),
// and the radius of the body is given by radius.
void snowman(int cx, int cy, int radius)
{
    circle(cx, cy, radius);
    circle(cx, cy - radius*3/2, radius/2);
}
//-----------------------------------------------------------------------------
