package library.core.model;

import library.core.system.CoreImageData;


/**
 * 最も基本的なモデル
 * @author 貴裕
 *
 */
public class CoreModel implements Cloneable{


	private float centerX;
	private float centerY;
	private float width;
	private float height;
	private float rotation;
	private int alpha;
	private boolean isChangeAlpha;	//alphaを変更したかどうか

	private boolean isShowView=true;	//ビューを表示させるかどうかのフラグ
	private CoreImageData imageData;


	public CoreModel(CoreImageData imageData,float centerX,float centerY,float width,float height){
		this.centerX=centerX;
		this.centerY=centerY;
		this.width=width;
		this.height=height;
		this.imageData=imageData;
		this.isShowView=true;
		this.rotation=0;
		this.alpha=255;
		this.isChangeAlpha=false;
	}


	public CoreModel clone(){

		CoreModel c=null;

		try {
			c=(CoreModel) super.clone();
			c.imageData=this.imageData.clone();
		} catch (CloneNotSupportedException e) {
			// TODO 自動生成された catch ブロック
			e.printStackTrace();
		}
		return c;

	}

	/**
	 * 描画されるタイミングで毎回呼ばれる (アニメーションに使用)
	 */
	public void drawUpdate(){
	}




	public float getCenterX() {
		return centerX;
	}


	public void setCenterX(float centerX) {
		this.centerX = centerX;
	}


	public float getCenterY() {
		return centerY;
	}


	public void setXY(float x,float y){
		this.centerX=x;
		this.centerY=y;
	}

	public void move(float x,float y){
		this.centerX+=x;
		this.centerY+=y;
	}

	public void setCenterY(float centerY) {
		this.centerY = centerY;
	}


	public float getWidth() {
		return width;
	}


	public void setWidth(float width) {
		this.width = width;
	}


	public float getHeight() {
		return height;
	}


	public void setHeight(float height) {
		this.height = height;
	}



	public CoreImageData getImageData() {
		return imageData;
	}


	public void setImageData(CoreImageData imageData) {
		this.imageData = imageData;
	}


	public float getRotation() {
		return rotation;
	}


	public void setRotation(float rotation) {
		this.rotation = rotation;
	}


	public boolean isShowView() {
		return isShowView;
	}


	public void setShowView(boolean isShowView) {
		this.isShowView = isShowView;
	}


	public int getAlpha() {
		return alpha;
	}


	public void setAlpha(int alpha) {
		this.alpha = alpha;
		this.isChangeAlpha=true;
	}


	public boolean isChangeAlpha() {
		return isChangeAlpha;
	}


	public void setChangeAlpha(boolean isChangeAlpha) {
		this.isChangeAlpha = isChangeAlpha;
	}






}
