public static void creerTaches(FrontendTasks tasks) {
tasks.taskGroup("AfficherPartie")
.waitsFor(created(DonneesVuePartie.class))
.contains(subTasks -> {
prochaineImagePartie(subTasks);
});
}
private static void prochaineImagePartie(FrontendTasks subTasks) {
subTasks.task("prochaineImagePartie")
.waitsFor(created(VuePartie.class))
.waitsFor(created(DonneesVuePartie.class))
.waitsFor(clock().nextTick())
.executes(inputs -> {
VuePartie vuePartie = inputs.get(created(VuePartie.class));
vuePartie.afficherMonde2d(monde2d);
});
}
public class VuePartie extends ViewFx {
@FXML
private CanvasPartie canvasPartie;
// ...
public void viderCanvas() {
canvasPartie.clearCanvas();
}
public void afficherImagesParSeconde(String fps) {
canvasPartie.afficherFps(fps);
}
public void afficherPong2d(MondePong2d mondePong2d) {
mondePong2d.drawOn(canvasPartie);
}