// File: design.cxx
// Written by: michael and Dmitry
// Draw some geometric designs using for loops

//----------------------------------------------------------------------------
#include <graphics.h>
#include <iostream>
using namespace std;
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
const int S = 256; // Size of a graphics window
//----------------------------------------------------------------------------

//----------------------------------------------------------------------------
int main()
{
    int px, py; // Pixel coordinates on the screen

    // Open a graphics window and fill it with red pixels
    initwindow(S, S, "Red");

    // Fill with all red starting with x=0, then x=1, ... from left to right.
    for (px = 0; px < S; ++px)
    {
	for (py = 0; py < S; ++py)
	{
	    putpixel(px, py, RED);
	}
    }
    delay(2000);
    cleardevice( );

    // Refill from right to left:
    for (px = S-1; px >= 0; --px)
    {
	for (py = 0; py < S; ++py)
	{
	    putpixel(px, py, RED);
	}
    }
    delay(2000);
    cleardevice( );

    // Refill from top to bottom:
    for (py = 0; py < S; ++py)
    {
	for (px = 0; px < S; ++px)
	{
	    putpixel(px, py, RED);
	}
    }
    delay(2000);
    cleardevice( );

    // Vary the amount of red, green and blue in the color!
    for (py = 0; py < S; ++py)
    {
	for (px = 0; px < S; ++px)
	{
	    putpixel(px, py, COLOR(px, py, 0));
	}
    }
    delay(2000);

    delay(200000);
    return EXIT_SUCCESS;
}
//----------------------------------------------------------------------------
