package mhcgp;

/** 
 *  Package mhcgp <br>
 *  class Eye <p>
 *
 *  author mhc<p>
 *  An eye is an oval that contains a pupil.  When someone sets our position,
 *  we want the pupil's position to change as well, and stay just a little
 *  below center.  The same idea holds for size, I want the pupil to be
 *  1/4th the size of the eyeball.
 */

public class Eye extends GP.Graphics.FilledOval {

  private Pupil _pupil;

  public Eye(GP.Container container) {
    super(container);
    this.SetColor(new GP.Attributes.Colors.Blue());
    _pupil = new Pupil(container); //we will use the same container
  }

  public void SetPosition(int x, int y) {
    this.SetPosition(new GP.Attributes.Position(x,y));
    //set the position of the pupil, use the same x and a y that's lower
    //than the center, but not too much
    _pupil.SetPosition(new GP.Attributes.Position(x,y+5));
  }

  public void SetSize(int x, int y) {
    this.SetSize(new GP.Attributes.Size(x,y));
    //set the size of the pupil, use the same x and y but make it one fourth
    //the size. 
    _pupil.SetSize(new GP.Attributes.Size(x/4,y/4));
  }
}
