package yourwork;

import java.awt.*;
import ignorethis.Mover;


/**
 * NAME: YOUR NAME HERE
 * COURSE: CompSci 6
 * DATE: April 15, 2010
 * PURPOSE:
 *   Represents a traditional Smiley face with smaller Smiley's within its eyes.
 */
public class Smiley extends Mover
{
    /**
     * Construct a picture at the given position, with the given size, and color.
     */
    public Smiley (Point center, Dimension size, Color color)
    {
        super(center, size, new Point(0, 0), color);
    }


    /**
     * Render picture in the given graphics context.
     */
    public void paint (Graphics pen)
    {
        drawSmiley(pen, getCenter().x, getCenter().y, getSize().width, getSize().height);
    }

    
    /**
     * Render smiley face in the given graphics context.
     */
    public void drawSmiley (Graphics pen, int cx, int cy, int width, int height)
    {
        // face
        pen.setColor(getColor());
        pen.fillOval(cx - width / 2, cy - height / 2, width, height);
        
        pen.setColor(Color.BLACK);
        // left eye
        pen.fillOval(getCenter().x - getSize().width / 8 - getSize().width / 20,
                     getCenter().y - getSize().height / 8 - getSize().height / 10,
                     getSize().width / 6, getSize().height / 4);
        // right eye
        pen.fillOval(getCenter().x + getSize().width / 8 - getSize().width / 20,
                     getCenter().y - getSize().height / 8 - getSize().height / 10,
                     getSize().width / 6, getSize().height / 4);
        // smile!
        pen.drawArc(getCenter().x - 11 * getSize().width / 40,
                    getCenter().y + getSize().height / 20 - 11 * getSize().height / 40,
                    11 * getSize().width / 20, 11 * getSize().height / 20,
                    345, -150);
    }
}
