package depart.frontal.vues;

import ca.ntro.app.Ntro;
import ca.ntro.app.frontend.ViewFx;
import depart.commun.monde2d.MondeDepart2d;
import depart.frontal.controles.CanvasB;
import depart.frontal.evenements.EvtA;
import depart.frontal.evenements.EvtSouris;
import javafx.fxml.FXML;
import javafx.scene.Cursor;
import javafx.scene.control.Button;

public class VueB extends ViewFx {

	@FXML
	private Button boutonA;

	@FXML
	private CanvasB canvas;

	@Override
	public void initialize() {
		Ntro.assertNotNull(boutonA);
		Ntro.assertNotNull(canvas);
		
		boutonA.setFocusTraversable(false);
		
		boutonA.setOnAction(evtFx -> {

			Ntro.newEvent(EvtA.class).trigger();
			
		});
		

		canvas.hideCursor();
		canvas.onMouseEvent(evt -> {

			Ntro.newEvent(EvtSouris.class)
			    .setEvtSouris(evt)
			    .trigger();
		});
	}

	public void methodeA(MondeDepart2d monde2d) {
		monde2d.drawOn(canvas);
	}

	public void methodeC() {
		//canvas.clearCanvas();
	}

	public void afficherImagesParSeconde(String imagesParSeconde) {
		canvas.afficherFps(imagesParSeconde);
	}

}
