Skip to content
Snippets Groups Projects
Laboratory.java 471 B
Newer Older
Jan Kožusznik's avatar
Jan Kožusznik committed
package lab;

import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;

public class Laboratory {

	public void draw(Canvas canvas) {
		GraphicsContext gc = canvas.getGraphicsContext2D();
		World world = new World(canvas.getWidth(), canvas.getHeight());
		while (!Routines.isEndOfThreadRequestedByJavaVM()) {
			gc.clearRect(0, 0, canvas.getWidth(), canvas.getHeight());
			world.draw(canvas);
			Routines.sleep(25);
			world.simulate(25);
		}
	}
}