package depart.commun.monde2d;

import ca.ntro.app.fx.controls.World2dMouseEventFx;
import ca.ntro.app.world2d.Object2dFx;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;

public class Palette2d extends Object2dFx {
	
	private int attrA;
	
	public Palette2d(int paramA) {
		super();

		setWidth(100);           
		setHeight(20);
		
		this.attrA = paramA;
	}
	
	@Override
	public void onAddedToWorld() {
		setTopLeftX(getWorldWidth() / 2 - getWidth() / 2);
		setTopLeftY(getWorldHeight() - attrA * 25);
	}

	@Override
	protected boolean onMouseEvent(World2dMouseEventFx mouseEvent) {
		return false;
	}
	
	@Override
	public void drawOnWorld(GraphicsContext gc) {
		gc.setFill(Color.CORNFLOWERBLUE);
		
		gc.fillRect(getTopLeftX(), 
				    getTopLeftY(), 
				    getWidth(), 
				    getHeight());
	}

}
