package edu.calpoly.csc480.Entomo.Ant;

import java.awt.*;
import javax.swing.*;

import edu.calpoly.csc480.Entomo.Area.*;
import edu.calpoly.csc480.Entomo.Tile.*;

public class AntView implements Icon 
{
	public AntView() {
		color = Color.black;
		setTileSize(AreaView.defaultTileSize);
	}

	final public int getIconWidth()			{return width;}
	final public int getIconHeight() 		{return height;}

	public void setDocument(Ant ant) {
		this.ant = ant;
	}

	public void setTileSize(Dimension tile) {
		final double shrinkFactor = 1.75;

		width  = (int)((double)tile.width  / shrinkFactor);
		height = (int)((double)tile.height / shrinkFactor);

		xOffset = (tile.width  - width)  / 2;
		yOffset = (tile.height - height) / 2;
	}
	
	public void paintIcon(Component c, Graphics draw, int x, int y) {
		draw.setColor(color);
		draw.fillRect(x+xOffset, y+yOffset, width, height);
	}

	protected Ant ant;

	protected int width, height;
	protected int xOffset, yOffset;

	protected Color color;
}