/*****************************************************************
 * Author: Ezra Velazquez
 * Date:   2/12/11
 * Prof:   Parker
 * Week:   3
 * Title:  SpeedTouch
 * Notes:  Updated version from last week's assignment
 *         Collision detection provided by Casey Reas 
 *         Open Processing Collision Examples 
 *         (http://www.openprocessing.org/visuals/?visualID=8004)
 * New:    Objects, comments
 *****************************************************************/
package speedtouch;
import processing.core.PApplet;

public class Rects {
	PApplet parent; // The parent PApplet that will render ourselves onto
	
	private int rHeight;
	private int rWidth;
	private int rColor;
	private int rX;
	private int rY;
	private int rNum;
	private boolean rTagged;
	
	// Set the rectangle default values
	Rects(PApplet p, int rectHeight, int rectWidth, int num) {
		parent = p;
		
		rHeight = rectHeight;
		rWidth = rectWidth;
		rX = (int) parent.random(50,700);
		rY = (int) parent.random(50, 600);
		rNum = num;
		rColor = parent.color(255, 192, 81);
		rTagged = false;
	}
	
	void display() {
		// Display rectangle
		parent.stroke(204, 102, 0);
		parent.fill(rColor);
		parent.rect(rX, rY, rWidth, rHeight);
		
		// Display number associated with rectangle
		parent.fill(0);
		parent.textAlign(parent.CENTER);
		parent.textSize(24);
		parent.text(""+rNum, rX, rY + 15, rWidth, rHeight);
	}
	
	/************************************************************
	 * Helper Methods
	 * *********************************************************/
	// Update x coordinate
	void setX(int rectX) {
		rX = rectX;
	}
	 
	// Return x coordinate
	int getX() {
		return rX;
	}
	
	// Update y coordinate
	void setY(int rectY) {
		rY = rectY;
	}
	
	// Return y coordinate
	int getY() {
		return rY;
	}
	
	// Update tag
	void setTag(boolean rectTagged) {
		rTagged = rectTagged;
	}
	
	// Return tag
	boolean getTag() {
		return rTagged;
	}
	
	// Update rectangle color
	void setColor(int R, int G, int B) {
		rColor = parent.color(R, G, B);
	}
	
	// Return width of rectangle
	int getWidth() {
		return rWidth;
	}
	
	// Return height of rectangle
	int getHeight() {
		return rHeight;
	}
}
