import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
import ngp.*;
import ngp.shapes.*;
import ngp.fills.*;
import ngp.behaviors.*;


public class Main
{
    public static final Dimension SIZE = new Dimension(600, 600);
    public static final String TITLE = "NGP - Demo";

/*
    static void makeShapes (ngp.Canvas canvas)
    {
        // create shapes
        Group g = new Group(canvas.getCenter());
        Oval o1 = new Oval(new Point2D.Double(   0,    0), new Dimension(600, 600), Color.BLUE);
        Oval o2 = new Oval(new Point2D.Double(   0, -150), new Dimension(100, 300), Color.WHITE);
        Oval o3 = new Oval(new Point2D.Double( 150,    0), new Dimension(300, 100), Color.WHITE);
        Oval o4 = new Oval(new Point2D.Double(   0,  150), new Dimension(100, 300), Color.WHITE);
        Oval o5 = new Oval(new Point2D.Double(-150,    0), new Dimension(300, 100), Color.WHITE);

        // group shapes together
        g.add(o1);
        g.add(o2);
        g.add(o3);
        g.add(o4);
        g.add(o5);

        // create animation behaviors
        g.add(new Spin(1));
        o2.add(new Spin(-3));
        o3.add(new Spin(-3));
        o4.add(new Spin(-3));
        o5.add(new Spin(-3));

        // add shapes to canvas so they are visible and animated
        canvas.add(g);
    }
*/
/*
    static void makeShapes (ngp.Canvas canvas)
    {
        // canvas.add(new Button(canvas.getCenter(), canvas.getSize(), Color.BLUE));
        Group g = new Group(canvas.getCenter());

        // group shapes
        Button b1 = new Button(new Point2D.Double(-125,-125), new Dimension(250, 250), Color.RED);
        Button b2 = new Button(new Point2D.Double(-125, 125), new Dimension(250, 250), Color.MAGENTA);
        Button b3 = new Button(new Point2D.Double( 125, 125), new Dimension(250, 250), Color.BLUE);
        Button b4 = new Button(new Point2D.Double( 125,-125), new Dimension(250, 250), Color.CYAN);
        g.add(b1);
        g.add(b2);
        g.add(b3);
        g.add(b4);
        g.add(new ngp.shapes.Image(new Point2D.Double(0, 0), new Dimension(75, 100), "images/rcd.gif"));

        // add behaviors
        g.add(new Spin(0.25));
        b2.add(new Spin(8));

        // display
        canvas.add(g);

        // debugging
        Rect marker = new Rect(new Point2D.Double(0, 0), new Dimension(25, 25), Color.BLACK);
        marker.add(new Centered(b1));
        canvas.add(marker);
    }
*/
/*    
    static void makeShapes (ngp.Canvas canvas)
    {
        AbstractShape s1 = new Oval(canvas.getCenter(),
				    new Dimension(canvas.getSize().width / 2,
						  canvas.getSize().height),
				    Color.MAGENTA);
        s1.setFill(new Gradient(Color.RED, Color.BLUE));
        // s1.setFill(new None(Color.GREEN));
        canvas.add(s1);

	s1.add(new Resize(0.99));
	s1.add(new Spin(5));
    }
*/
    static void makeShapes (ngp.Canvas canvas)
    {
        // canvas.add(new Smiley(canvas.getCenter(), canvas.getSize(), Color.YELLOW));
        Group g = new Group(canvas.getCenter());

        // group shapes
        Smiley s1 = new Smiley(new Point2D.Double( 0,    0), new Dimension(160, 160), Color.YELLOW);
        Smiley s2 = new Smiley(new Point2D.Double( 0, -120), new Dimension( 80,  80), Color.YELLOW);
        Smiley s3 = new Smiley(new Point2D.Double( 0, -200), new Dimension( 80,  80), Color.YELLOW);
        Smiley s4 = new Smiley(new Point2D.Double( 0, -280), new Dimension( 80,  80), Color.YELLOW);
        g.add(s1);
        g.add(s2);
        g.add(s3);
        g.add(s4);

        // add behaviors
        g.add(new Spin(2));
        s2.add(new Spin(-2));
        s3.add(new Spin(-2));
        s4.add(new Spin(-2));

        // display
        canvas.add(g);
    }


    public static void main (String args[])
    {
        // create container that will actually do the work
        ngp.Canvas display = new ngp.Canvas(SIZE);
                       
        // create container that will work with Window manager
        JFrame frame = new JFrame(TITLE);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // frame.addKeyListener(new ShipMover(display));
        // add our container to Frame and show it
        frame.getContentPane().add(display);
        frame.pack();

        // make game objects
        makeShapes(display);

        // start the animation
        frame.show();
        display.start();
    }
}
