CardImage.java
Home Up BelotConstants.java Card.java CardImage.java Cards.java Game.java Interface.java Player.java RunInfo.java

 

 

import java.awt.*;
class CardImage implements BelotConstants
{
	CardImage (int row, int column, Image imageName, int height, int width)
	{
		// 10 percent borders
		topLeftX = column * width / NUMBER_COLUMNS  + width / NUMBER_COLUMNS / 10;
		topLeftY = row * height / NUMBER_ROWS + height / NUMBER_ROWS / 10;
		xExpanse = 8 * (width / NUMBER_COLUMNS) / 10;         // 80 percent width
		yExpanse = 8 * (height / NUMBER_ROWS) / 10;           // 80 percent height
		image = imageName;
		display = true;
	}
	public boolean inImage(int x, int y)
	{
		if ((x >= topLeftX) && (x <= topLeftX + xExpanse) &&
			(y >= topLeftY) && (y <= topLeftY + yExpanse))
			return true;
		else 
			return false;
	}
	public void setImage(Image imageName){image = imageName;}
	public void setDisplay (boolean d) {display = d;}
	public Image getImage () {return image;}
	public boolean getDisplay () {return display;}
	public int getTopLeftX () {return topLeftX; }  // all 4 are WIDTH redundant
	public int getTopLeftY () {return topLeftY; }
	public int getXExpanse () {return xExpanse; }
	public int getYExpanse () {return yExpanse; }
	private Image image;
	private boolean display;
	private int topLeftX;
	private int topLeftY;
	private int xExpanse;
	private int yExpanse;
}